The 0 (zero) key on my Mac keyboard does not work anymore. Is there some kind of ascii code to type this character?
You may need to connect a USB keyboard if you need to make a change or enter 0 as part of a password, but once you're logged in you can copy / paste the 0 and also enable the keyboard viewer in system preferences.
That lets you get a 0 from the pointer / mouse / trackpad
Additionally, you could shift your keyboard mapping to Dvorak (left or right) and use a different physical key until you decide to get it repaired or see if you're ok using unicode hex input method.
With the unicode hex keyboard, you hold down option and type hex (0030 for zero) instead of ascii code.
The main problem with unicode entry is the 0 is used quite a lot, so you'll probably want to set up a shortcut to convert another character to 0 or get a bluetooth keyboard.
To make a shortcut, go to system preferences/keyboard/text/replace with. To create a custom layout where 0 is on a working key, try Ukelele.