We can reduce to the definition of an effective Cartier divisor $D$ on the scheme $X$, which is a closed subscheme $D\subset X$.
Such a divisor is locally defined on an affine open subset $U= Spec(A)\subset X$ by $U\cap D= V(f)$ where $f\in A$ is not a zerodivisor .
To conclude you have to remember that if the ring $A$ is noetherian its zero divisors are exactly the union of its associated primes (Atiyah-Macdonald Prop.4.7) : $Zdiv(A)=\bigcup_{\mathfrak p\in Ass(A)} \mathfrak p=\bigcup_{\mathfrak p\; \text {a minimal prime}} \mathfrak p$
Remark
This definition of Cartier divisor has many advantages.
In particular we have $dim(D)\lt dim(X)\:$ (if $dim(X)\lt \infty $) and this would be violated with a less stringent definition of "divisor":
For example take for $X$ the cross $X=V(xy)\subset k[x,y]=\mathbb A^2_k$ ($k$ a field).
If you allowed $D=V(\bar x)\subset X$ as a Cartier divisor, you would have $dim(D)=dim(X)$: this is the punishment for allowing a zero divisor like $\bar x$ (with $\bar x \bar y=0)$ to define a Cartier divisor.