Let $X$ be a smooth separated integral variety over an algebraically closed field.

Question:Is it true that a basis for the Zariski topology is given by the family $$\mathcal{U}=\{X\setminus \mathrm{Supp}(\mathrm{div}(f))\mid f\in K(X)\}$$ where $\mathrm{div}(f)$ is the principal divisor defined by $f$?

Some ideas that I have had

If $X=\mathrm{Spec}(A)$ is an affine integral variety this is true because for $f\in A$ we have that $X\setminus\mathrm{div}(f)$ is equal to the principal open set $D(f)$ and these generate the topology.

The question is equivalent to the following:

For each prime divisor $D$ on $X$ and a point $x$ outside $D$ there is a rational function $f$ vanishing on $D$ and invertible on $x$.

Indeed, if $\mathcal{U}$ is a basis then we can find a function $f$ such that $x\notin \mathrm{div}(f)$ (i.e $f$ is invertible at $x$) and $D$ is a component of $\mathrm{div}(f)$. Then either $f$ or $f^{-1}$ works.

Conversely, consider an open set $U$ and $x\in U$. The complement $F=X\setminus U$ is a closed set with some irreducible components $F_i$. Take a function $h_i\in \mathcal{O}_{X,x}\setminus \mathcal{O}_{X,F_i}$. Then divisor of poles $\mathrm{div}_{\infty}(h_i)$ contains $F_i$ but not $x$. Let $D=\bigcup \mathrm{div}_{\infty}(h_i)$. By the hypothesis, for each component $D_j$ of $D$ there is a function $f_j$ vanishing on $D_j$ but invertible on $x$. Then, $f=\prod_j f_j^{n_j}$ vanish on $D$ and is invertible on $x$ for some appropriate choice of $n_j\in \mathbb{Z}$.

- If $X$ is a quasiprojective variety this is also true. We can see this using the idea in the previous point. Given a prime divisor $D$ and a point $x$ not in $D$ take an ample divisor $H$ different from $D$ and not containing $x$. Then for some $n$ big $nH-D$ is very ample (because the ample cone is open) then it is base-point free and so it has a section $f$ not vanishing at $x$ but vanishing at $D$.

I think this question is related to the concept of divisorial variety (cf. the remark after definition 3.1 in Divisorial Varieties, Borelli, 1963). In some sense, a variety satisfying this is like a *principally divisorial variety*.

If this is not true for smoothness, it would be still nice if we have the result for something less restrictive than quasi-projective. Something that contains smooth proper toric varieties for example.