It's a sort of Murphy's Law of knitting that whenever you start a project with a discontinued yarn, you're bound to need more than you have and be unable to locate it. Here are some ideas of where you might be able to find discontinued and out of stock yarn to complete your project.
Yarn Resale Websites
To start with, Discontinued Name Brand Yarn is a great resource, particularly for yarn brands that have recently been discontinued. This online store buys stock from yarn stores that are closing as well as stock of discontinued yarn from manufacturers.
You can often get even better deals if you buy the yarn by the bag, which is great if you need a lot of yarn for a project. And if you're just looking for good deals on yarn and don't care what you get, this site's grab bags are a lot of fun.
There are other sites that sell discontinued yarn, just do a search online for the term discontinued yarn or the particular yarn you are looking for to find them.
Auction and Craft Sites
Of course eBay is a great place to look for yarns of all vintages that have been discontinued. Search for the particular yarn you are looking for and you might find a ball, a partial ball or a whole bag or more.
Sometimes you will find what you are looking for in a mixed lot, meaning that it's being sold with a bunch of other yarn by someone who's just looking to get rid of a lot of stuff. You'll have to decide if it's worth it to you to spend as much as you'll need to in order to get what you really need and if you'll use the other stuff in the lot (you can always contact the seller and see if they'll break up the lot if you only need the one ball).
On Etsy, search destash yarn or look for the particular yarn you need. Etsy doesn't have the selection that eBay does, but it's often worth a look.
Ask Other Crafters
If all else fails, a great source for discontinued yarn is other crafters who might have some in their stash. You can ask around on the About.com Knitting Forum and the Ravelry In Search of/Destash Group to see if someone has the yarn and would be willing to sell it to you or trade it for something in your stash.
A Word of Warning
Of course when looking for a discontinued yarn it's highly unlikely you'll be able to find the same dye lot you were working with; you might not even be able to find the same color. In the case of different dye lots, alternating rounds or pairs of rows from two different dye lots will make the difference less noticeable.
If you end up having to buy a different color of the same yarn, of course then you're looking at stripes or a color block pattern, but that's a great way to jazz up a plain piece of knitting.