I made this mistake too, if i remember correctly, first you need to run down the first "alley" so keep walking through to the second door. Once you get into this area, you should be able to go up to "aladdin's house". Exit Aladdin's house, and I believe the magic carpet arrives. It's tough to tell where you are, has the scene with jafar and jasmine happened yet? have you been in aladdin's house? is this your first time in agrabah? please post more info so i can help you more. You definitely need to go to aladdin's house so you can open the keyhole. Let me know, I hope this helped.
-Christina