Hello and Welcome....
Have a look at the Buyers Guide in the E53 Section of the Forum and a lot of your questions may be answered in there. There are all sorts of things to be aware of, hopefully none of which will come to affect you once you find the one you want......
I guess the key messages have to be that you absolutely must check
everything, give very serious consideration to a warranty, and if not - have cash you can spend to fix these things because some of the bills can be high. You have already mentioned the Pano Roof - that's a getting on for £2k repair, as is a transmission failure. The newest E53s are at 6 years old so things will go. If you can go to maybe a 2005/6, you might find a better car - although in a higher VED band than the 04/5 version if registered after late March 06.
Oh, and take your time. There are plenty of good examples out there along with some real shockers. Make sure any car you buy from a dealership has a decent initial warranty - no £500 limit jobs!!
Do not be afraid to ask here though as there are some very experienced Owners with a huge collective range of knowledge.....
Richard