Not a lot of thought is given to windows, especially in a dungeon. After all, what can you see underground? So, if you want to have a window trap, you need to create a window that is especially compelling to look at or through, just like the one below.
The windows in this room look out on… well, it’s hard to say, they are extremely dirty.
Type: mechanical; Perception DC 26; Disable Device 27
Trigger touch; Reset None
The windows look into a small cave that is filled with a poison gas. Cleaning the windows will show the a green gas filled cave. However, in order to see the windows, they must be cleaned. Wiping the windows may cause them to break, and using liquid causes them to dissolve, letting in the gas from the cave. If the windows are wiped, a DC 22 Reflex Save is required or they break. Poison Gas (DC 16 Fortitude Save or take 1d6 Con damage and be knocked unconscious for 1d6 rounds); multiple targets (all targets in room)
What adventurer can resist taking a peek through this window to see what is on the other side? Of course they will check it for traps, after all, a window can be an unusual thing. They will want to make sure that there aren’t poison needles or Constrictor Curtains or any other kind of nasty thing on the windows. They’ll probably even check to make sure the grime isn’t something that will cause ability loss.
You’ll probably end up with a mage hand or some mechanical contraption cleaning the glass, while the party is safely far away. Of course the glass will break, and you can even have the gas pressure cause some shards to fly inwards, and the players will think they have avoided the trap. But they haven’t. If you are devious, you can have the gas accelerate into the room slowly, so the characters can see the cave before the gas overtakes them.
This same type of mechanic can work with other elements, where the trap isn’t so much the dungeon element itself; it’s what’s beyond that is dangerous.