Gmail Labs has released Advanced IMAP Controls, which lets you control the labels that appear as IMAP folders and make Gmail behave a bit more like a traditional IMAP server:
From the team that brought you Mail Goggles, here comes…Advanced IMAP Controls, a Labs feature that lets you fine-tune your Gmail IMAP experience. You can choose which labels to sync in IMAP — useful if you find your mail client choking on a big [Gmail]/All Mail folder.
After enabling this Lab, just go to the Labels tab under Settings. You’ll see a new ‘Show in IMAP’ checkbox next to each of your labels. Uncheck the box and the corresponding folder will disappear from IMAP.