When the noun is countable, it requires an article: "I do not have an apple".
When the noun is uncountable, you must not use an indefinite article: "I do not have rice".
You can use the definite article "the" in both cases.
This may be why the OP is getting confused whether to use "a"/"an" or not.