I recently read something by Aza Raskin that resonated with me. He suggested that delegation -- letting others have ownership over your baby -- is an essential part of leadership that is often inhibited by an attachment to the product, and this attachment comes from the fact that the product's success or failure is a reflection of your own success or failure as the product's leader. I would go even further and suggest that throwing away your work altogether is sometimes an essential part of leadership, and it is an act that is often avoided for the same ego-driven reasons.
I am fortunate to have learned early on in my life when to throw away work into which I've put a lot of time and effort. It's very difficult to walk away from something you've created and nurtured, but it's important to evaluate your situation in the moment. What you've already done is a sunk cost, while going forward you have an opportunity to change course and do something with different potential. You can pursue hobby projects out of love for the craft, and it's hard to know when you're giving up too easily. But for important projects that are at a dead end, don't let ego get in the way of letting go.