I ran across this for the first time, and thought it was worth putting together in one spot. I was trying to deploy a solution into my test environment, which happened to have one web-front-end server offline. Whether or not that was the cause I have no idea, but the solution decided to sit and wait. After doing a bit of searching, I came across the canceldeployment command, but either due to bad luck or the net filter at work, I was unable to find out what the deployment id should be. So I poked around a bit more and finally found the enumdeployments command.
Putting the pieces together you get:
stsadm –o enumdeployments
This will present some XML spew. It’s easily readable, so find your solution name and get the job id. Then…
stsadm –o canceldeployment –id <id>
This will nuke the pending operation and put your solution into an error state. You may then retract, delete, and try again. This same process works for stuck retractions too.