Location and Uses
Locks are mostly present in the dungeons of each game, halting Link's progress through a certain room until he either completes the room's puzzle, or locates the appropriate key to unlock the door somewhere in the previous portion of the dungeon.
Types of Locks
A Bar Lock is a kind of lock on a door usually found in all dungeons. These locks cannot be opened unless a certain task is completed. For example, defeating enemies, moving a block/pot onto a switch, etc. They are called bar locks because of the metal bars that drop down in front of the door to prevent Link from opening it. In a Sub-Boss room, the bars drop down when Link enters the room and lifts up when the Mini-boss is defeated.
Boss Locks are special locks to the bosses lairs that requires Link to find a Boss Key.
Originally, as first introduced in A Link to the Past, the Boss Lock opened up to yield a couple final puzzle rooms before the actual boss room. As the series progressed though, the distance between the Boss Lock and the actual Boss Room shortened, and eventually, the Boss Lock became the very final obstacle Link faced before attempting the dungeon boss. Link's Awakening marks the first appearance of true Boss Locks, of which are opened with a Nightmare Key. Every level has a Nightmare Key and a Boss Lock right before the Boss Room. Ocarina of Time, Majora's Mask, and The Wind Waker boasts Boss Locks in the temples (all dungeons in The Wind Waker), and have the final puzzle rooms, made familiar by Link's Awakening, placed before the Boss Lock, and by extension, the Boss Room, as well. However, the final battle of Majora's Mask, in the Moon, does not incorporate the Boss Lock, unlike Ganon's Castle from Ocarina of Time, as Link must talk to the child wearing Majora's Mask to proceed directly to the final battle.
With the introduction of Twilight Princess, the Boss Lock lost its static appearance in favor of setting and atmosphere. All the boss locks take after the theme of their dungeon, for example, the bedroom lock found in Snowpeak Ruins resembles a heart instead of the common eye-like shape of the boss locks of previous titles.
Locked doors, which are mostly found in dungeons, require a Key to open. The keys from a particular dungeon can be used only on doors within that same dungeon with the exception of the original The Legend of Zelda in which keys could be used in any dungeons.
A door with a bar lock from Ocarina of Time