I never said the prank is unsuccessful, only that darkness doesn't make it harder to find something by ear. Hearing is hearing, sight is sight.
In the past, I have had a hard time finding by ear which switching power supply in a lab is giving off a squeal.
Seeing the power supplies was of no help; it might as well have been dark.
Basically the "off when the lights are on" aspect just confounds people initially when they don't know that this is the case. They hear something in the dark. They hear it beep again some time later, and then again. They turn on the lights to go looking for it. Unbeknownst to them, doing so deactivates it. It takes time to learn that the chirping is related to it being dark. Once they realize that, it makes next to no difference.
It's still not a bad prank without that embellishment.