A lock was a device used on several things, most often doors, to seal them and prevent them from being opened without the correct key.
The Doctor's TARDIS was stated to have twenty-one different locks on the inside, with only one being the correct lock. Inserting the key inside the wrong lock would lead to the locking mechanism melting. (TV: The Daleks) Later, the lock was said to have a metabolism detector, which blocked entry to the Brigadier when the Third Doctor was absent. (TV: Spearhead from Space) Other times, simply possessing the key was enough for someone to be able to unlock the doors. (TV: Blink)
A deadlock seal could be added to a lock to improve security. Sonic devices such as the Doctor‘s were ineffective against these types of locks. (TV: Bad Wolf, Invasion of the Bane et al.) However, some could be keyed to specific deadlock seals, as Matron Cofelia’s sonic pen was to the building of Adipose Industries. (TV: Partners in Crime)