Some time ago, I ask this same question, the solution, given to me by Platonides, was to change a line in the source code of MediaWiki 1.10
if ( 0 == $this->getID() ) { wfProfileOut( __METHOD__ ); $wgOut->setStatusCode(404); // CHANGED
Now, I have MediaWiki 1.12, What are the lines I must change now? Why not include permanently this feature in the main source code?