Unfortunately the DMV will not allow you to register your BMW X5 without a passing smog certificate or a smog check waiver from the Smog Referee's office.
We were unable to find any recalls regarding the ODB II system of a 2004 BMW X5, however we did find other BMW models, such as the M3 which did require software update in order to communicate with the smog machine. Nor did we find any information put out by the Bureau of Automotive Repairs regarding the testability of the BMW X5; this leads us to believe your vehicle either has a faulty ECU, OBD connector/harness, or Data Link Connector power failure or ground failure.
We are surprised BMW (dealership) has been unable to locate this fault. If in fact BMW can not find anything wrong with your BMX X5 and they seem to think there is something wrong with the State's smog check inspection system (BAR-97 Smog Inspection System, or the new DAD System) you should obtain documentation from them and present it to the Smog Check Referee's Office. The smog check referee should then grant you a one time two year smog exemption certificate. This obviously does not resolve your vehicle's OBD communication problem, but at least it will allow you to register this vehicle for now.