It sounds like it is a hood switch problem. The tension between hoodswitch and the hood may have weakened over the years. You can try adding more tension by adding a small rubber feet between hood and hood switch sensor. See DKL's post with pictures on this thread:
http://www.xoutpost.com/x5-e53-forum/...d+alarm+sensor
If this solves the issue, you might actually save a trip to the dealer.