How can I force the Mac app store to re-install an application? For some reason, I cannot convince the app store that an application (Xcode, in this case) is not installed.

I have deleted /Developer (which only contained an old, busted Xcode 3.2.3) and tried to rebuild the LaunchServices DB (using lsregister -kill -r -domain local -domain system -domain user) but to no avail; The app store stubbornly claims that Xcode is already installed.

I'm at my wit's end, here.
For Xcode, try to go to /Applications and move "Install Xcode" to trash.

I think Xcode is a special case, it doesn't get deleted when you delete it form launchpad.