From the IRS website:
If you need an exact copy of a previously filed and processed return and all attachments (including Form W-2 (PDF)), you must complete Form 4506 (PDF), Request for Copy of Tax Return and mail it to the IRS address in the instructions along with a $39 fee for each tax year requested. Copies are generally available for returns filed in the current and past 6 years.
In cases where an exact copy of the return is not needed, tax return and transcripts may be ordered. The tax return transcript shows most line items contained on the return as it was originally filed, including any accompanying forms and schedules. In most cases, a tax return transcript will meet the requirements for lending institutions for mortgage verification purposes.
The transcript can be ordered by completing a Form 4506-T (PDF) or calling (800) 829-1040 and following the prompts in the recorded message. There is no charge for the transcript and you should receive it in 10 business days from the time the IRS receives your request. Tax return transcripts are generally available for the current and past three years. If you need a statement of your tax account which shows changes that you or the IRS made after the original return was filed, you must request a "Tax Account Transcript". This transcript shows basic data including marital status, type of return filed, adjusted gross income, taxable income, payments and adjustments made on your account. Tax return and account transcripts are generally available for the current and past 3 years.
Form 4506-T (PDF) can also be used to get proof from the IRS that you did not file a tax return for a particular tax year.
Forms can be downloaded at Forms & Pubs or ordered by calling (800) 829-3676.