The diamond BMW key has a built-in rechargeable battery. The battery in the key you see below is not meant to be replaced. BMW designed it so that it charges via the induction in the ignition coil. Except that doesn't always work.
Not all diamond keys have a rechargeable battery. Some can be opened and you can easily replace the battery. The model below can not be opened without having to cut it.
So I came up with a unique solution to charge a BMW diamond key. If you drill two small holes on the key, you will be able to charge it using an external 3-volt battery.
Pay attention to the positive (red) and negative (black) posts. When you connect the external battery, you have to connect positive to positive and negative to negative.
I connected two double AA batteries (3 volt total) in series and left them connected for 30 minutes.
The only other possible solution to this problem, is to cut open the case, remove the old battery and solder a new one.
This video shows how to open the key and replace the battery.