Load posts from external source if not found in database

Possibly the place to do this would be in the 404.php file of your theme. If there isn’t one, create one and WordPress will pick up. Note: if you want to return “non-404” content from this file you will probably need to clear the headers and set the status to 200.

I’ve done something very similar on other systems and it works fine if you take care to return the correct headers.

One word of warning though: you might want to minimise the amount of processing that happens on the this page as otherwise you might end up impacting site performance if you start lots of processing on every single 404.