In the Settings app make sure the "Page not found for non-published documents" is checked. Then you can set a global page not found URL.
You can also create a generic page like /No-Longer-Published and enter aliases for it for each of the pages you unpublish.
If you're looking to do this automatically, you could create a custom event handler that adds this alias when the document is unpublished.