Get to the top door and get into the sixth room. After killing all the Heartless here, go back to Room 2. After getting rid of all the Heartless in this room, strike the door and head to the fifth room. You can use a Moogle Synthesis card if you have one, or just battle all of the Heartless and hit the door to the right again.
After battling all of the Heartless in this room, hit the door to the right. If you don't have one, go through the door like you normally would. After battling all of the Heartless in this room, hit the door with the Keyblade and synthesize with a Black Room card. After the conversation, you'll learn Terror and get the Key of Beginnings. When Sora, Donald, and Goofy arrive at Halloween Town, they come across Jack Skellington He explains Halloween Town's Heartless problem to them, and Sora, Donald, and Goofy decide to help.