I am reasonably sure that the following statement is true if by a “space” we mean either a smooth quasi-projective variety or a complex manifold:
Let $M$ be a space, $E \to M$ a vector bundle, and $\sigma$ a global section of $E$. Then there exists a unique line bundle $L \to M$ up to isomorphism such that $\sigma$ can be twisted into a section of $E \otimes L$ whose zero set has codimension $\ge 2$.
(Needless to say, all vector bundles are correspondingly algebraic or holomorphic.)
Proof for smooth quasi-projective varieties:
Let $L = \mathcal O_M(-D)$, where $D$ is the divisor of zeros of $\sigma$ of codimension $1$. Then locally multiply $\sigma$ it times a rational function with poles along $D$, obtaining a global section of $E \otimes L$ with no zeros of codimension $1$. Obviously, if we twist $\sigma$ by a different divisor, then the result will have some codimension $1$ zeros, so $L$ is unique up to isomorphism.
Proof for complex manifolds:
By the Weierstrass preparation theorem, the local ring $\mathcal O_{M,p}$ is a Noetherian UFD for every point $p \in M$. Hence, there exist holomorphic functions $h_j$ defined on an open cover of $M$, with the same codimension $1$ zeros as $\sigma$'s. Therefore, $\tau_j = h_j^{-1} \sigma$ only has zeros of codimension $\ge 2$.
The $\tau_j$'s are related by the transition functions $g_{jk} = h_j h_k^{-1}$, which are a priori only meromorphic. However, each $g_{jk}$ extends continuously to the complement of $\tau_k$'s zero set, so, by the Hartogs extension theorem, it is a holomorphic transition function. Hence, the $g_{jk}$'s define a line bundle $L \to M$ and the $\tau_j$'s define a global section $\tau$ of $E \otimes L$.
Finally, because $M$ is paracompact, the open over on which the $h_j$'s are defined may be assumed locally finite. Since $\tau$'s zero set is a locally finite union of codimension $\ge 2$ sets, $\tau$'s zero set itself is a codimension $\ge 2$ set.
The uniqueness of $L$ follows from the same argument as in the algebraic case.
Are these proofs correct?
The proof for complex manifolds was horribly verbose. Can I just reuse the proof for smooth quasi-projective varieties in the complex manifold case?
Does the proof for smooth-quasi projective varieties also work for a larger class of algebraic varieties? (I guess what I am asking is essentially “when does a Weil divisor uniquely determine a Cartier divisor?”)