Making sure an overflow doesn't flood a room is pretty easy.
It really is based on design.
The bottom of the u-tube in the skimmer box must be lower than the top of the drain in the back box (siphon box, drain box - whatever you want to call it).
When the power goes out, the back box will...