You could be encountering peer to peer AirPlay which allows others that are in close proximity to AirPlay to an Apple TV without having to be logged onto your wifi network. In flats and apartments, this can also include neighbours.
Whilst it won’t stop others trying to AirPlay to your Apple TV, to cover the possibility that it may be being done by accident, you may wish to think whether the name of your Apple TV is sufficient to deter accidentally trying to connect. You can change the name of your Apple TV at Settings ➔ General ➔ About ➔ Name.
You can also set your AirPlay security settings to avoid those you don’t want being able to AirPlay to your Apple TV or ensure that the message you have seen stops.
There are two types of protection for AirPlay.
The first is an on-screen passcode, in which the Apple TV will display a four number password on screen, which you must enter into your mobile device before AirPlay can be enabled. This typically ensures that users are in the room where the TV is, before enabling AirPlay. This typically protects against intentionally disruptive behaviour from someone somewhere else while someone is trying to use AirPlay.
The second is a hidden password which needs to be remembered by all users who will have access to AirPlay unless you share this password with others. This method doesn’t lend itself well to use by guests unless you tell them your password but it does mean that accidental attempts from others don’t disturb you.
On the Apple TV 2/3 you can turn either type of protection on or off by navigating to Settings ➔ AirPlay ➔ Security. On the Apple TV 4 you can change the type of security in use but not turn it off at Settings ➔ AirPlay ➔ Access Control ➔ Security.