Per IRS Publication 946 How to Depreciate Property, starting on page 7:
Retired From Service
You stop depreciating property when you retire it from service, even if you have not fully recovered its cost or other basis. You retire property from service when you permanently withdraw it from use in a trade or business or from use in the production of income because of any of the following events.
For additional information, please refer to IRS Publication 544 Sales and Other Dispositions of Assets.
Note that any link in the information above is updated each year automatically and will take you to the most recent version of the document at the time it is accessed.