If you attempt to edit the default view of the document library from within SharePoint you should see a section titled "Folders". Expanding that section will give you two options... "Show documents inside folders" and "Show all documents without folders". I'm not sure which "data connection" you've established to the document library, but you may want to look into using web services to enumerate the documents. I think the web service list service allows you to specify a view to use. If you set up a view with "Show all documents without folders" you should be able to use that view to query the document library.