Is there any physical principle preventing the creation of perfect sound-canceling headphones?
Yes. An active noise cancelling headphone contains a tiny microphone inside the ear cup, and the electronic circuit is pretty good at minimizing the sound level at the exact location of the microphone.
Your eardrum is not at the exact location of the microphone. It's pretty close though, and so the active noise cancellation works pretty well for frequencies whose wavelength are significantly larger than the distance separating your eardrum from the mic. But the higher the frequency (the shorter the wavelength), the less well the active noise cancellation works.
Fortunately, the effectiveness of sound absorbing materials (e.g., foam rubber) increases with frequency. Active noise cancelling headphones generally rely on the active electronics to minimize the low frequencies (the rumble of a jet engine), and they rely on the material properties of the ear cups to attenuate the higher frequencies (the crying baby in the seat behind you.)
Now, instead of headphones, how about a device that can cancel all the sound in the room for all the listeners in the room?
Nope: For the reason stated above, active noise cancellation only truly works at one exact point (the location of the microphone.) The further you get from that point, the less well it works. More than a few centimeters away, and it's not going to have any noticeable effect...
...Except, if the noise is a pure tone, emitted by a speaker in a fixed location, then that tone sets up standing waves in the room, and if you switch on an active noise canceller, it will emit a similar pure tone with a different standing wave pattern that will reduce the "noise" at many places in the room while reinforcing the "noise" at other places.
In a real situation, where the noise contains many frequencies, and it comes from many locations, then you'll be dealing with so many overlapping standing waves that you won't really be able to make any sense of it. On average, when you switch the machine on, you probably won't notice any change unless your ear is right next to the mic. That'll be the only location where all of the standing waves cancel each other out.