A common fungus in the soil called Aspergillus niger causes black mold on onions. If you remove the affected layers or cut off the affected area with some margin, the rest of the onion can be used. As an exception, people allergic to Aspergillus niger should not use onions with black mold, even if the affected area was removed.