"I don't have a fence."
Translation:Ich habe keinen Zaun.
Zaun is masculine and the masculine accusative form is keinen. kein would only be correct if the noun were neuter (at least in a position where accusative is required like here).
As for your bonus question: That’s correct. For example: Ich habe keine Mauer. (I don’t have a wall.)
1) The fence is the direct object, hence in accusative case – and the article needs to correspond: ... einen Zaun...
2) "If what you are negating is a noun, "nicht" or "kein" (or "keine," "keinen" etc.) will precede the noun. Use "kein" if what you are negating is a noun preceded by ein/eine."
3) If you say Ich habe nicht einen Zaun..., many German speakers will expect you to continue with ... , sondern (number > 1), because one would take the nicht to negate the number (which can look like the indefinite article) and not the (article +) noun.
nicht ein (in whatever case) is almost totally non-existent in German; we use kein (in that case). You can do the same thing in English as well, although it sounds somewhat antiquated: “I have no fence.”
There are only two cases where I might say “nicht ein” and both of them involve unusual emphasis due to special contexts:
- If I want to stress the number for contrast: “Ich habe nicht einen Zaun, sondern zwei.” (I have not one fence but two.) – But this is not a possible interpretation in our sentence above because the English version has “a” rather than “one”.
- If I want to put special emphasis on the noun for contrast: “Ich habe nicht einen Zaun, sondern eine Mauer.” (I have not a fence but a wall.)
And even then nicht einen is only obligatory in the first of these contexts. In the second, even though nicht einen is acceptable, I would still prefer keinen.
TL;DR: It’s safest to just use kein instead of nicht ein at all times and reserve nicht ein for when you want to say “not one [but another number]”.