A door key.
A locked door.
|"The notches on this ancient iron key are well worn; its leather lanyard battered with age. What door might it open?"|
A door key allows the player access to whatever is behind the locked door that the key happens to fit. This locked door will always be on the same level as the key is found, but each key is unique and will unlock only one door. If your key doesn't unlock a door, then there must be another locked door somewhere on the same level. A door key occupies an inventory slot when carried, and is consumed once used to unlock a door.
There are usually very good things behind locked doors and there's usually no other way to get to them, so it's often worth the risk one must take in order to get a key.
What risk? Keys are only generated as part of a treasure machine. Generally this comes in two parts: a key holder, in which a challenge is presented to the player in order to obtain the key or not die after obtaining it; and a reward room, where valuable items can be found behind a locked door that can only be opened with the key. Sometimes keys are rather easily obtained and sometimes they are quite well protected. It really depends on how well prepared you are. You need to take a look at the surroundings and think about what might be in store for you should you decide to go for the key.
A door key should not be confused with a cage key, which fulfills a different purpose.