Before Kingdom HeartsEdit
Based on the Ansem Reports, Xehanort had opened a door deep beneath the castle, allowing the Heartless to overrun it, destroying Hollow Bastion and breaking the barriers in between worlds. Thus, the Final Keyhole in the game is most likely an artificial one, created as a means to enter into Kingdom Hearts and as a source of immense darkness and power.
Maleficent, Riku and the other Disney Villains began to gather the Princesses of Heart to gain the powers of darkness and to open the door to Kingdom Hearts. Riku only wants to find a way to save Kairi's heart.
Maleficent and Riku are the only ones left when they obtain all the Princesses of Hearts. However, the Keyhole is not truly unlocked because Kairi has lost her heart and cannot release her power. After defeating Maleficent twice, Sora fights with Riku a second time. This time Riku is taken over by Ansem, Seeker of Darkness and informs him that Sora is carrying Kairi's heart within him. Sora uses Riku's Keyblade of People's Hearts to save Kairi's heart and release the other princesses' hearts from the Keyblade. After Sora does this, he loses his heart and Kairi is revived only to complete the Keyhole.
When the Keyhole is revealed, several powerful Heartless are released. These are the Phantom, Kurt Zisa and the weakest of them, the Behemoths. The Keyhole is only sealed during Sora's second visit to Hollow Bastion, but the way to Kingdom Hearts is still open with Xehanort's Heartless waiting.
The Final Keyhole appears in Sora's memories, when Roxas was dreaming about them.
The Final Keyhole appears in Xion's dreams about Sora's memories.
The Final Keyhole appears in the data Hollow Bastion, which Data-Sora enters to rescue Maleficent and Pete as the Datascape begins to collapse.