For some physical intuition, if a vector field is conservative (i.e. can be written as the gradient of a potential), then you can think of the potential as a "landscape" such that the vector field is always pointing from high potential to low potential (or the other way around depending on your convention).
In this case, following the vector field will lead you to encircle the $z$-axis and return to where you started. But this is a problem - following the vector field means that you're always decreasing (or increasing) the value of the corresponding potential, so how can you end up back where you started? This is an intuitive clue that such a potential cannot exist - at least on the domain you are considering.
To illustrate the mathematical problem concretely (and somewhat inelegantly, but elegance is overrated), we can assume that there exists some potential $P$ such that $\vec v = \nabla P$ for all points except the z-axis. If that is the case, then for any closed loop $\gamma:[0,2\pi] \rightarrow \mathbb R^3-\{0,0,\mathbb R\}$ we would have that
$$\int_\gamma \vec v \cdot d\vec r = P\big(\gamma(2\pi)\big) - P\big(\gamma(0)\big) = 0$$
We can parameterize $\gamma$ via
$$\gamma:t \mapsto \big(\rho(t) \cos(\theta(t)\big), \rho(t) \sin(\theta(t)), \zeta(t)\big)$$
This is a completely generic parameterization, which makes no assumptions about the path. If we do this, then after a bit of algebra we find that
$$\int_\gamma \vec v \cdot \mathrm d\vec r = \int_0^{2\pi} \frac{B}{\rho(t)} \begin{bmatrix}-\sin\big(\theta(t)\big)\\ \cos\big(\theta(t)\big)\\ 0\end{bmatrix} \cdot \begin{bmatrix}\rho'(t) \cos\big(\theta(t)\big) -\rho(t)\sin\big(\theta(t)\big)\theta'(t)\\ \rho'(t) \sin\big(\theta(t)\big) + \rho(t)\cos\big(\theta(t)\big)\theta'(t)\\ \zeta'(t)\end{bmatrix}$$
$$= \int_0^{2\pi} B \theta'(t) \ \mathrm dt = B\big[\theta(2\pi) - \theta(0)\big]$$
This of course assumes that $\rho(t) > 0$ for all $t\in[0,2\pi]$. Furthermore, since we have claimed that the path is closed, we must have that $\theta(2\pi) -\theta(0) = 2\pi n$ for some integer $n\in \mathbb Z$ (otherwise it would not come back to the same $\psi$ coordinate). As a result, we have that
$$\int_\gamma \vec v \cdot d\vec r = 2\pi Bn_\gamma$$
where $n_\gamma$ counts the number of times the path $\gamma$ winds around the $z$-axis. This quantity is called the winding number of $\gamma$, and it is an example of a topological invariant - which is a fancy way to say that if we can obtain some other curve $\xi$ by continuously stretching or twisting $\gamma$, then $n_\xi = n_\gamma$.
So to summarize, if $\vec v = \nabla P$, then $\int_\gamma \vec v \cdot \mathrm d\vec r = 0$ for all closed curves $\gamma$. However, we have explicitly shown that any curve which loops around the $z$-axis some non-zero number of times results in a non-zero winding number and therefore non-zero integral. Therefore we must conclude that there is no $P$ such that $\vec v = \nabla P$ for all points away from the $z$-axis.
And just because I can't help myself - we could sidestep this issue by choosing a different domain such that there are no continuous paths which encircle the $z$-axis. For example, we might consider the half-space defined by the requirement that $x>0$. On this domain, there are no loops which encircle the $z$-axis, and so the integral under consideration must vanish for all closed loops $\gamma$. We therefore cannot say definitively that $\vec v$ cannot be written as some $\nabla P$, and in fact the reverse is true - on this restricted domain, $\vec v$ can be expressed as the gradient of a potential, and everything works smoothly.
This is a concrete example of the Poincaré Lemma. It emerges beautifully in the study of differential geometry and differential forms, but for now, it can just be a counterexample to the claim that irrotational fields $(\nabla \times \vec v = 0)$ must be conservative $(\vec v = \nabla P)$. The reverse is true - all conservative fields are irrotational - but the original statement is not guaranteed to be true if the domain under consideration is not simply-connected.