Morkus from Orkus
But isn't that is exactly the question? Probably the best test would be to have a group of players charged with defending a site and seeing what they come up. Because they are players they are limited to published spells and items. So "anti-invisibility" areas aren't something possible in the rules, but hallowed areas would be. Give them a budget and see what kind of defenses they can build. In my opinion, to build defenses to handle the types of threats represented in a normal game world is going to be cost prohibitive compared to the methods that are necessary to defeat them.
This is probably why they haven't released the mass combat rules yet. It would be interesting to try and build a "tower defense" game just using the published rules to this point. But I don't think the rules are really robust enough to handle this situation. Back in AD&D we did run similar types of tests and found that castles were generally useless against monstrous and magical threats.
They aren't spelled out in the rules, but the rules for creating spells and magic items ARE in the rules. It's inconceivable that anything the players can think of hasn't been tried hundreds, if not thousands of times in the thousands of years that magic and castles have been around. Countermeasures would have been created and be in widespread use by places as rich as cities and the nobility/royalty.
It's definitely much harder if you limit the players/NPCs to what spells and items are listed, though.