Hi Rico,
All you need to do is just change:
PORT_PMUX_PMUXO_H
to...
PORT_PMUX_PMUXE_H
The MKRZero has digital pin 2 on port PA10. This is an even port (rather than an odd one), hence the E instead of the O.
I tested your code on the my Arduino Zero and it works, giving an 8MHz output.
Kind regards,
Martin