I can’t do a murder mystery because the PCs will just cast speak with dead.
I’ve seen this sentiment a lot, but it’s never really made any sense to me: The act of investigating a mystery is one by which you reveal that which is unknown. When we talk about PCs casting a speak with dead spell, we’re describing a situation in which the players reveal that which is unknown (i.e., they investigate the mystery), but then, oddly, we’re supposed to conclude that they can’t investigate the mystery because the investigate the mystery.
I think part of the problem here lies in an erroneous instinct that I talked about as part of the Three Clue Rule:
There is a natural impulse when designing a mystery, I think, to hold back information. This is logical inclination: After all, a mystery is essentially defined by a lack of information. And there’s a difference between having lots of clues and having the murderer write his home address in blood on the wall.
But, in reality, while a mystery is seemingly defined by a lack of knowledge, the actual action of a mystery is not the withholding of knowledge but rather the discovery of knowledge.
Let me put it another way: Strip the magic out of this scenario. Imagine that you’ve designed a mystery scenario in which there was a witness to the crime. The PCs turn to this witness and say, “Who killed him?” and the witness says, “It was Bob.” And it turns out Bob is just standing there, so they arrest him. End of mystery.
You wouldn’t conclude that you can’t do mystery scenarios because people can talk to each other right?
Speak with dead should be no more alarming than an FBI team taking fingerprints or a CSI team enhancing video and running facial analysis.
DESIGN TO THE SPELL
You may also see people suggesting that you “nerf” the spell to one degree or another. (Corpses that refuse to answer questions, for example.) Nothing is more frustrating to a player than having their smart choices blocked because the GM has some preconceived notion of how they’re supposed to be investigating the crime.
But what you can do is design your mysteries to the reality of the spell. Generally speaking, after all, people in the game world know that the spell exists, right? So they aren’t going to plan their murders in ways that will expose them. (Any more than people in a magic-free setting will commit their murders while standing directly in front of surveillance of cameras.) They will find ways to conceal their identity; they may even find ways to try to use the spell to frame other people. (For example, imagine a murder scenario where the victim thinks one of the PCs did it because the perpetrator used a polymorph spell.)
The same advice generally applies to other divination spells, too. The only divination effects which are truly problematic are those which allow you to contact omniscient beings and receive crystal clear information from them. Fortunately, these spells basically don’t exist in D&D (and most other games). The closest you can get are commune and contact other plane, but both are explicitly limited to the knowledge of the entity you’re contacting. (1st Edition AD&D actually had a lovely table for determining “Likelihood of Knowledge” and “Veracity”.)