You can add a 404 not found page for your Astro website just by creating a normal Astro page at src/pages/404.astro
.
Most static hosting services (Netlify, Vercel, etc) will pick this page up as a 404 page, and show it when there’s no matching page at a given URL.