I was finally able to find a solution to this problem. The question originally didn't tag "Okta" or "C#", but I believe this error was encountered when trying to follow the setup instructions here:
https://developer.okta.com/blog/2020/10/23/how-to-authenticate-with-saml-in-aspnet-core-and-csharp
As noted in the article open the SAML Setup Instructions, which can (currently) be found by clicking the "Sign On" tab of your application:

The value you in the "Identity Provider Single Sign-On URL" should look something like this:
https://dev-xxxxxxx.okta.com/app/dev-xxxxxx1_testapp_1/exk3--------------/sso/saml
Using this URL will result in the DTD error as shown in the question.
To build the correct URL:
- Remove the URL section between "app" and "exk...". I think this is the appId, but not sure.
- Add "/metadata" to the end
So, based on the above example, the final URL will be:
`https://dev-xxxxxxx.okta.com/app/exk3--------------/sso/saml/metadata
As a quick test, you should be able to hit this URL in a browser.
FWIW, this aligns with mybrave's answer, but with a bit more detail on how to get the correct metadata URL.