I wasn't aware of how common this problem was until I experienced it - my door sensor stopped working i.e. the car wouldn't detect that my driver's door was open. This meant my window wouldn't do the slight roll down when I opened the door, the dome light wouldn't come on when I opened the door and most importantly the car wouldn't "bong" at me when I left my lights on...which lead to several instances of a dead battery.
Upon investigating it turns out this is a fairly common problem. There was some info I found in the AudiWorld FAQ but now it's FUBAR'd and I can't find it.
Here's how I went about fixing mine:
1. First I removed the door panel...probably the easiest thing to do on the whole car.
You have to first twist off the round metal cap at the base of the door handle (the thing that caps the metal cylinder where the window switches are). I believe you turn it counter clockwise. Once you have that off, there will be a lone torx screw in there...unscrew it and remove it. Then, grab the handle and lift up on the door card and you should feel it slide off the door.
Once you have access behind it, unhook the cable that attaches to the upper door release handle from the handle. Then, to get the card out of the way, just set it down on your door sill where it would normally sit when the door is closed...now it's conveniently out of your way.
2. Next you have to get the door latch assembly out; to do this you need to undo the two bolts on either side of the latch. You should use a 12 point bit to do this, and by "should" I mean "you can get away with using a torx bit carefully." However AutoZone and other parts stores do sell the 12 point bits, so I had a set to use.
Once you have it unbolted you have to disconnect the cable that ties the latch to the door handle. You have to turn the end of the cable the right way to let it slide off the lever that attaches it to the latch assembly. You can see the cable end here:
This was a bit tricky for me.
Next, just disconnect the wiring harness and the latch assembly should be free.
3. Now that you have the latch out, you can pop the sensor out (follow the blue and red wires, undo the clip and pull it out). Most likely you will see that it stopped working due to the rubber cap on the plunger getting worn off - it's no wonder. The design is crappy; you have rubber rubbing directly on another surface, it's BEGGING to wear out.
You can see here how it's worn the surface of the latch as well:
In case you haven't figured it out, the worn part slides into contact with the plunger on the switch to close the circuit and let the car know that the door is open.
4. Apparently, there's a switch sold at Radio Shack that people use in place of the OEM switch, but I couldn't find any switch of this style at my local Radio Shack. So I resorted to a switch I had laying around, albeit much larger than the original piece:
So I ended up orienting the switch perpendicular to the OEM orientation to make it fit. I drilled a hole to attach it with a screw on one side and positioned the other side to sit against the body of the latch itself to prevent the switch from moving. Here's a picture of how it turned out:
So how you rig it depends on what switch you get a hold of, but that's how I did it.
5. Make sure you reassemble everything correctly. The paddle looking thing here:
Is what actuates your lock mechanism. Make sure it sits where it's supposed to in the latch assembly. Don't forget to reattach the cable for the handle as well.