How can I test if a request returns a 404? In my 404 template I am extending a layout template. Inside that layout template I want to hide a section use an {% if craft.request... == 404 %} test. Any ideas on how I can accomplish this?
That solution is viable. You can just test to see if the entry or the template matches your 404 template/entry. If you routed everything correctly to display a 404 in case of error, you should be fine.