Earth amulet and doors
When wearing the earth amulet, locked doors (but not other doors) block you. Unlocked but closed doors you can pass through, and attacking creatures will usually open the door before they attack you when you're standing on that space. In addition, some creatures (notably goblin rockthrowers) will throw missiles through closed, unlocked doors.
EDIT:
If you're standing on a closed door, monsters unable to open doors (bears, hydras, etc.) are unable to attack you.