The prison key is a quest item used only during Troll Stronghold. It opens the door to the troll prison and is a drop from both the level 113 Troll generals in Troll Stronghold. Players must kill a general to get the key.
As Troll generals may hit high (up to 38 hitpoints), it is recommended to use a safespot or protect from melee when trying to kill one for the key. Once the key is dropped, players may enter the locked door to continue the quest.
For an exhaustive list of all known sources for this item, see here