First you have to stop it.
mdadm --stop /dev/md0
Then you can remove it:
mdadm --remove /dev/md0
mdadm, arrayfirst, dev, md,