If you have acted in good faith in getting the loan but were denied, then you can technically still get your deposit back. Your agent would need to convey your good faith efforts to the listing agent and the seller. What happened was unfortunate but at the end of the day, it would be in everyone's best interest to come to an agreement. The sooner the contract is cancelled, the sooner the house can be back on the market. With inventory being low to none, seller would have no problem finding a buyer right away. And with multiple offers, seller may get more money than what the cancelled contract was for. Everyone would be in a 'win-win' situation!
The issue here is the contingency window...are you within your contingency period or have you removed contingencies yet?
Generally these things get worked out but going to mediation is the next step. If you don't have an agent, you might also consult an attorney who can explain your contract details.
Best of luck.
Your loan was denied because you can't show enough funds for the down payment. and not for any other life changing events or lender's requirements beyond your control.
Proof of funds for your down payment is something within your control. You know that you have to come up with XXX amount of dollars beforehand.
It is your obligation and responsibility to adhere to the contract you have signed.
In my opinion, you have not done your diligent effort to fulfill your obligation as the buyer for the property you have agreed to purchase.
Seek a legal advice.