Title company has blank forms. Put your name in as buyer and sign and get the seller to sign their name and get the money back.
As long as you had the contract subject to loan approval you should have no problem. If there is a dispute you may have to go to artitration or file in small claims court if you feel you are correct and deserve the refund.