It happens more than anyone admits. You cant get representation for your book. It could be timing, that its a niche book that won't sell millions or you're just on a different path than the publishing industry. Before we go it alone, there are smaller publishers who do not pay advances, but will work with you to get your book into print.
The problem is there are others do no have your best interest at heart. How to avoid the scams, read a contract, protect yourself and your rights.
Publishers are not always huge and some small publishers have published some very popular books.