I am also having a similar problem with my Desire HD - can not connect to wifi in my office, even though other smart phones (including Galaxy S, WinMo6.5 and Iphone 3 and 4) and laptops are able to connect.
Sometimes it just insists that the network is out of range. Then I click on "Forget" and re-scan to find it again, select it, put in the (doubly-checked) proper password, and then it connects.
Many times it will connect and then immediately disconnect. After several times I click on Connect again, it will remain connected. Clicking on it shows me it has an excellent/good signal strength, as well as a proper IP for it.
The wireless icon at the top of the screen is on, but on it it appears that there is no signal at all (all the half-circles are grayed out).
The end result - I can not surf the web with any application.
Is it a common Desire HD problem? Or maybe some hidden checkbox somewhere that is causing these problems? Perhaps an incompatible app is to blame?
Another important note - the wireless works just fine at my home. Both locations have a wireless G with WPA2 passphrase.
---EDIT---
Sorry, just checked it again, and now it works in my office.
I think I was playing with checking for updates (while connecting to the net through USB) - there were none. Also at one time I unchecked the "Best Wi-Fi performance" checkbox at the advanced wireless setting (I think it was a while ago, but maybe it made the difference)