I'm looking for a working solution, to detect a current 403 or 404 state from within a template (page.tpl.php) in Drupal 7.
Unfortunately, Drupal seems to be unable to handle error pages.
If my assumption is correct, then you are looking for the way to handle 404 and 403 pages.
If that is the case,
Goto configuration->Site information, there you can specify your own page for handling 404 or 403 pages.
For that particular page, you can write tpl file like