You should be able to go to escrow and let them know you want to cancel due to not qualifying for a loan, take a copy of your purchase contract showing the contingency period, have them draw up a cancellation and sign it. Please make sure you do this as soon as possible as you don't want any more delays.
Oh gosh. I hope that I understand all that. Your buyers agent really is the one to ask this to - or your real estate lawyer if you have one. It sounds like it might be that your agent might also be the sellers agent ... that's not a great thing for you.
So I can be entirely wrong here but it sounds to me like the contract will default since you didn't get the loan. And in this case, you should get your deposit back. I'm not personally aware that the seller can require you (unless the contract specifies otherwise) to continue shopping for a loan just because they want you to.
In theory you have fulfilled your end - you applied, were denied, and that should give you a clean out.
But ... again - talk to your buyers agent asap. If the buyers agent also represents the seller (like dual agency) then I'd be wary of being forthcoming with him/her - and talk w/ your attorney - or get a quick free consult with one if you don't have one currently.