How can I get the intended URL in a 404?

$_SERVER['REQUEST_URI'] is your only option. wordpress failed parsing the url so not much you can get from the API