This error message mostly appears alongside other errors. The majority of the time it will clear as soon as all other listing errors for Amazon have been cleared.
The first thing to confirm when seeing this error is that the two values are properly filled out, they can be found under Edit SKU > General Info:
(For more information about defining hazmat or hazardous materials see this article)
Normally these fields need to be filled out no matter what Amazon category the SKU is listed in. If there are no batteries involved at all, you can normally set Are Batteries Required to "No" and Supplier Declared Dg Hz Regulation to "Not Applicable" (Do not select "None")
If you have filled in these values and still see the error, it usually indicates that another error remains to be resolved. Below in an example we can see a number of duplicate battery errors:
But once the Missing Attribute errors for Unit Count and Unit Count Unit of Measure attributes are added and the listing is updated/pushed to amazon, the battery errors will clear on their own.