It is obligatory for every Muslim to cover his `awrah while praying. The `awrah for men is from the navel to the knee. As long as this area is thoroughly covered, prayer will be valid.
-------------------------------------------
From the Fatwâ Department Research Committee:
The obligatory dress for men during prayer is to cover between the navel and knee. However, it is preferred to cover the shoulders as well.
Ibn Qudâmah in al-Mughnî writes: “The knees themselves do not have to be covered (i.e. they are not `awrah) as stipulated by Imam Ahmad, Mâlik and al-Shafi`î. Abu Hanîfah, however, says that they must be covered.”