Dungeons should be more than places where the PC’s go to kill monsters and take stuff. Dungeons are living and changing places with an ecology and personality. One of the most infamous examples would be the murderous Tomb of Horrors, a site so legendary that it is often thought of as the primary adversary of the adventure.
I don’t mean dungeons should be out to get the party. There certainly is an appeal to that but like there are many types of NPCs (even just among villains) there should be a variety of dungeons. Over the years I’ve heard of cities (most notably New York) or starships as being the last character of an ensemble. This can be true of dungeons as well. Some dungeons as I pointed out might be openly hostile to the PCs while others, thanks to advance study or because of divine alignment could be virtually allied to the party.
Imagine a tomb of a long dead saint defiled by a group of tomb raiders and bandits who use the site as a camp for further raids on the local towns. When the PCs arrive to scour the bandits they may find the blessings of the saint to be upon them, giving the party a small leg up over the more numerous bandits. Especially if the departed saint and the party’s cleric share a deity.
The important part is that as the GM you should know you dungeon’s history and current events and your player’s characters should learn much of the dungeon’s story before, during, and/or after a delve. If the PCs in the previous example scout the bandit camp in advance the advantage they might have could be less divine and more a matter of secret entrances and hidden passages recorded in old church documents. Once inside the saint’s tomb these hidden corridors allow the PCs to pull a Die Hard sneaking around and killing bad guys in manageable numbers. You might also allow your party to bypass ancient traps much as Indiana Jones passed the three tests with his father’s Grail Diary during the final act of the Last Crusade.
Don’t overlook mid-dungeon discoveries either. Murals, and engravings can tell the PCs valuable secrets or warn the wary of traps and dangers. Using the same techniques as the filmmakers used in Last Crusade of warning our heroes of traps with riddles you can also scribe those riddles right into the walls of the dungeon themselves.
Not that heeding these warnings might not come with their own risks. In the temple of a dread devil or demon, following the ritualized instructions to “grovel before the master” (to avoid a decapitation trap) or “mortify the flesh” and deactivate a magical trap with a sacrifice of one’s own blood could eventually lead to taint and corruption.