Craft SeoMatic GTM  disable on 404 pages
SEOmatic author here -- what version of SEOmatic are you using? I think the best way to do this would be to just disable the container from being included in your 404 Twig template:

{% do seomatic.script.get('googleTagManager').include(false) %}


As per: https://github.com/nystudio107/craft-seomatic#google-tag-manager