Software developed seldom works in isolation.
Connecting to external systems such as databases and consuming 3rd party APIs are integral parts of many products made today.
However, how do we write tests for these BEFORE we write code that integrates with these external systems?
I don't think the answer is different for TDD and writing tests in the end. You need a way to provide the dependencies: usually with fakes.