There is likely a financing and inspection contingency at the least in your agreement. You should be able to have your lender write a denial letter regarding your financing. If that does not work (it should), you may have to go through the inspection prcess and hope there are alot of repairs that you can use as angle to get out and get your deposit back. In either case your earnest money should be returned.
The other agents are correct you should immediately let your agent know that you cannot get financing.
Most offers have a financing contingency written in, meaning if you can't obtain a mortgage within a certain timeframe you can back out. If you dont have the funds to close then it seems to me your mortgage would be declined. You could have your lender write a letter of denial for you. But first and foremost if you are working with a buyers agent you should consult with them
There are two things you should do immediately:
1. review your purchase agreement to determine what is specified relative to your earnest money.
2. have a conversation with your agent to process the best rout to go to recover your deposit.
Discuss this with your Realtor. the details of the contract is best discussed with them. Here in Florida we write various conditions so the buyers can withdraw without losing their escrow. Each situation is unique however. I would not advise my buyers to make an offer unless they are financially ready.
Hope this helps.