I was considering my games, and I thought that I might put out some thoughts on my own methods for messing with the classic PC 'scry & fry' tactics. As a GM, spells like divination, commune, and contact other plane are exceedingly dangerous to your plotlines if you aren't careful. Similarly, scrying is a danger, but far more manageable to deal with. I've been toying with them of late, and thought I'd share some of my strategies for dealing with it.
1) Do nothing: In this case, the opponent is the type who doesn't know how such magic works or simply doesn't care. Thus, they're doomed to an early grave. But let's be honest...if you shut down these tactics every time, you're just being a jerk. Sure, having the PCs dismantle an encounter/plot you spent days, weeks, or even months building can suck, but remember, they're playing the game too. In this case, I recommend seeing my next option below.
2) Make decoys: There are multiple levels of this option, but the most common is that the villain you were chasing was just the minion of someone far more powerful than they were. If you had a villain who was taken out too easily, who you put tons of work into? Then make them the stooge of the shadowy villain. Perhaps they were brainwashed into believing they were in charge, or they simply don't know the name of the real villain...or maybe they're just an honest to goodness miniboss. This is a decent option whether you plan it ahead of time or not. But if it's a replacement? Have your real villain not make the same mistakes.
3) Scrying Protection: The classic here is mage's private sanctum, at least in Pathfinder. It covers a 30 foot cube per level, lasts for 24 hours, and can be made permanent for the price of 12,500 gp. On the other hand, it blocks all other divination spells, and also blocks vision into the area warded, so it can be that this isn't necessarily what you want...but hey, it gives a baseline for things, doesn't it? Come to think of it, I'll rework this to determine the pricing on a ward at the end of this post...anyway, back to scrying. Another option that most people ignore is that lead sheeting flat out blocks scrying. It's listed right there under the Divination school. So an intelligent opponent should be smart enough to make sure that there's lead in the walls, or mixed into the mortar between bricks. Do the same for the floor, add leaded glass windows, and make certain not to ignore the roof. Lead is cheap, so it wouldn't be hard to do for any proper lair. I'll admit, I got some of my inspiration from Pathfinder #35, War of the River Kings, where the author takes the measures with lead into account.
4) Mind Blank: I'm only putting this in there because no discussion is complete without it. Yes, it utterly blocks divination spells. Yes, it's without equal. Yes, it makes that wizard with greater invisibility immune to true seeing or see invisibility. It's also absurdly high level, and unless you're at that point, not an option. Instead look at things like nondetection, screen, and the like. Lower level spells can still be effective. But not as much as not knowing who to look for...
5) False Appearance & Name: Divinations are only as good as the information you ask about. If you ask too vague of a question, or your players do, you shouldn't give them freebies. Let it fail to give them anything useful. At least, unless the PCs feel just as good about the villain casting divination and asking "Who is the greatest threat to me?" and getting all of the PC's names, favorite tactics, current location, and so forth. Make them work for it. The villain can make this harder by taking a different shape that's all too common (brown-haired, brown-eyed middle-aged human), and a name that is bound to refer to the wrong individual (John Smith). If the PCs can't figure out the opponent's actual name and appearance, scrying or other divinations suddenly become much, much more difficult to manage, and they'd best rely on footwork to work things out.
Now, none of these address dimensional travel like teleportation...but that's as it should be. There are possible defenses in-system, and villains should try to make their lairs either impossible to micro-manage destinations to (anti-scrying), or use actual spells to block it (dimension lock/forbiddance). Personally, I've begun adding things to address long-range teleportation in my home campaigns...but that's neither here nor there.
Now, my custom Anti-Scrying enchantment! Including math!
Mage's Private Sanctum is a 5th level spell, requiring an 11th level wizard. Multiplying those together, followed by 2,000 gp for a continuous use item, is 110,000 gp. Now, since it has a base duration of 24 hours, you divide the cost by 2. This drops it to 55,000 gp...which isn't bad for an item you can wear which blocks sight/hearing/divinations into eleven 30 foot cubes. However, if you assume a floor is 10 feet high, you don't need 30 foot cubes. Let's drop those to 10 foot cubes, shall we? A single 30 foot cube turns into twenty-seven 10 foot cubes. This means that that item covers 297 10 foot cubes. Due to this, I divide the cost by 300 to simplify my life. This comes to 183.33, repeating, gp per 10 foot cube. Now, considering how bloody useful this enchantment is...that's way too cheap. Unless you're going to have a single item covering a massive area, anyway. So as an enchantment on a 10 foot cube section of dungeon...let's increase the cost to 250 gp per 10 foot cube, and strip off some of the side abilities. Honestly, this came to a LOT less than I expected, but whatever. Below is my quick-and-dirty template for this enchantment.
School moderate abjuration CL 10th
Price 250 gp per 10 foot cube
The floor and walls of this chamber are covered in hundreds of tiny runes that glow with eldritch light. Any creature or object within the warded area is immune to divination effects as though they were within the area of mage's private sanctum. The other aspects of the spell do not apply within the area, only the prohibition on divination affects. A creature may still identify magic items or auras with detect magic by touching the creature or object in question while the spell is in effect, and the creator of the ward may designate that bearers of a specific item, such as a holy symbol or arcane mark, may use divination spells without being blocked by the ward. The object or symbol must be chosen when the ward is created.
Requirements Craft Wondrous Item, mage's private sanctum; Cost 125 gp per 10 foot cube