In addition to some fine advice from others in the thread: in D&D mysteries you either have to forbid the use of divinations and other similar problem solving spells from the beginning or actually plan around them. If you don't, you end up with a bunch of DM plot reasons it doesn't work instead of either not having the spells or the villain(s) actually having a defense.