On our websites as someone visits a non-existing page, we dinamically create a 404 error page that returns a status code 404.
It works perfectly on localhost, but on the server the same page returns the standard 404 IIS (7.0) error (
For the error code, you could specify location of your custom page.