I use Xcode every day and have it in the Dock.
So, seeing a question mark on it was bizarre. The menu still worked (I could see a list of my previous projects) but the icon wouldn’t launch Xcode.
Turns out this was because I’d upgraded Xcode. So the app it linked to no longer existed. The list of previous projects was probably there due to file associations.
The solution: drag it off the Dock. You’ll see a cloud appear and, when you release, it gets removed. Then drag the application back in from Applications.
More here (fwiw): http://support.apple.com/kb/ph6804