When someone is denied there is usually a pretty quick reason why. There are generally some things that, over time, can be corrected so that they will be able to buy a home in the near future. Once in a while, speaking with a different lender may make the difference too.
Some lending institutions have softer guidelines than others. Some can fit the square peg in the round hole. But, those instances are few and far between these days. Most lenders have pretty specific rules and regulations that they must adhere to.
There was an article in the NY times last week that may help answer some of your questions about what you can do if you are denied a loan. Sometimes I haven't even met the buyer before they are denied so I can't make these suggestions to them:
All is not lost if you are denied, listen to the advice you are given by your trusted Realtor and financial advisers. Now may not be the time for you, or you may need to make some mini changes....or you just may need to find another lender.