Magnetic scalar potential of a straight wire If we have a finite straight wire carrying a current $I$, we can integrate the Biot-Savart Law for the magnetic field along the wire and find the field at every point of the space as:
$$
\mathbf{B} = [0,B_\phi,0]; \quad B_\phi = \frac{\mu_0 I}{4\pi a}(\cos\alpha_1-\cos\alpha_2);
$$
where $a$ is the distance from the wire and $\alpha_1, \alpha_2$ are the angles between the evaluation point and the end-points of the wire.
Similarly, by integration of the Biot-Savart Law for the magnetic vector potential, we find:
$$
\mathbf{A} = [0,0,A_z]; \quad A_z = \frac{\mu_0 I}{4\pi}\ln\left(\frac{z_1+\sqrt{z_1^2+a^2}}{z_2+\sqrt{z_2^2+a^2}} \right);
$$
where $z_1, z_2$ are the segments between the projection of the evaluation point on the straight wire and the end-points of the wire.
It can be verified that $\nabla\times\mathbf{A}=\mathbf{B} $.
I'm now struggling to find a formulation for the magnetic scalar potential in a region of the space that does not contain the straight filament, so that:
$$
\mathbf{B} = -\nabla\Psi.
$$
Any idea on this? I was not able to find any reference online or on Electromagnetics books.
Many thanks in advance for any suggestion.
 A: The short answer is that the curl of the vector field you found is not zero, even at points where there is no current;  so there cannot be a scalar potential for it.  This is straightforward enough (if tedious) to verify:  assign coordinates to the ends of the wire (I recommend $x = y= 0$ & $z = \pm d$);  write out $\cos \alpha_1$ and $\cos \alpha_2$ in terms of $d$ and $\rho$, the distance from the axis (which is the same as your $a$);  and take the curl of the resulting expression for $B_\phi$ in cylindrical coordinates.  The $\rho$- and $z$-components of the result will be non-vanishing in general because $\partial (\rho B_\phi)/\partial \rho$ and $\partial B_\phi/\partial z$ are not zero.
As to why this happens, this is due to an underappreciated subtlety of the Biot-Savart Law.
For the Biot-Savart Law to yield a magnetic field satisfying Ampere's Law ($\nabla \times \mathbf{B} = \mu_0 \mathbf{J}$), it is necessary that $\nabla \cdot \mathbf{J} = 0$.  Specifically, if you take the curl of $\mathbf{B}_\mathrm{BS}$ as defined by the Biot-Savart Law, then after heroic amounts of vector algebra (see, for example, §5.3.2 of Griffiths) you get to the statement that
$$
\left[ \mathbf{\nabla} \times \mathbf{B}_\mathrm{BS} \right]_\mathbf{r} = \mu_0 \mathbf{J}(\mathbf{r}) - \frac{\mu_0}{4 \pi} \iiint \left[\nabla_{\mathbf{r}'} \cdot \mathbf{J}(\mathbf{r'}) \right] \frac{\pmb{\mathscr{r}}}{\mathscr{r}^3} \, \mathrm{d}^3\mathbf{r'} 
$$
where $\pmb{\mathscr{r}} \equiv \mathbf{r} - \mathbf{r}'$ and $\mathscr{r}$ is its magnitude.
For a current configuration which is divergence-free, this last term will vanish and everything's jake.  However, in the case of a finite segment of wire, this is not the case;  there is a "source" of current at one end of the wire, and a "sink" of current at the other.  This means that you cannot expect this term to vanish, which means you cannot expect $\nabla \times \mathbf{B}_\mathrm{BS}$ to be zero.  And if $\mathbf{B}_\mathrm{BS}$ is not curl-free in some region, there cannot be a scalar potential for $\mathbf{B}_\mathrm{BS}$ in that region.
To actually show that the curl of of $\mathbf{B}_\mathrm{BS}$ fails to vanish in this case, we can model the "source" and "sink" of current in this configuration via Dirac delta-functions:
$$
\nabla \cdot \mathbf{J} = 4 \pi I \left[ \delta^3(\mathbf{r} - \mathbf{r}_A) - \delta^3(\mathbf{r} - \mathbf{r}_B) \right],
$$
where $\mathbf{r}_A$ is the location of the "source" and $\mathbf{r}_B$ is the location of the "sink".  If you plug these into the above integral, you find that
$$
\frac{\mu_0}{4 \pi} \iiint \left[\nabla_{\mathbf{r}'} \cdot \mathbf{J}(\mathbf{r'}) \right] \frac{\pmb{\mathscr{r}}}{\mathscr{r}^3} \, \mathrm{d}^3\mathbf{r'} = \mu_0 I \left( \frac{\mathbf{r} - \mathbf{r}_A}{|\mathbf{r} - \mathbf{r}_A|^3} - \frac{\mathbf{r} - \mathbf{r}_B}{|\mathbf{r} - \mathbf{r}_B|^3} \right)
$$
It is evident that the curl of $\mathbf{B}_\mathrm{BS}$ does not vanish anywhere in space;  and of course this will be the same result you would get if you did the rigamarole described in the first paragraph. So there cannot exist a scalar potential such that $\mathbf{B}_\mathrm{BS} = - \nabla \Psi$.
You might also notice that the curl of $\mathbf{B}_\mathrm{BS}$ looks like an electric dipole field, and you might wonder why this is so.  Well, in reality, if we have $\nabla \cdot \mathbf{J} \neq 0$, we would then have $\partial \rho /\partial t \neq 0$ as well.  In this case, we would expect two point charges $\pm Q(t)$ at either end of the wire, creating a dipole electric field whose magnitude is increasing linearly with time. And the full time-dependent version of Ampere's Law is
$$
\nabla \times \mathbf{B} = \mu_0 \mathbf{J} + \epsilon_0 \mu_0 \frac{\partial \mathbf{E}}{\partial t}
$$
which means that at points not on the wire (where $\mathbf{J} = 0$), $\nabla \times \mathbf{B}$ will be proportional to a dipole electric field.  Neat!

You may well wonder whether we could get around this by making the line segment into a closed loop (so that the "sources" and "sinks" cancel out), or making the finite segment into a infinite wire (so that the "source" and "sink" terms go to zero.)  In this case, it is true that $\nabla \times \mathbf{B}_\mathrm{BS} = 0$ everywhere except at the points of the wire.  However, the set of "all points in space minus the wire" will be topologically non-trivial in this case;  specifically, it will not be simply connected.  And the statement that "a curl-free vector field can always be written as the gradient of a scalar" is only true on simply connected spaces.  So you will still be unable to find a scalar potential for $\mathbf{B}$.
A: The two crucial theorems surrounding vector and scalar potentials are
Irrotational Fields Have Scalar Potentials
A vector field $\mathbf{V}$ may be written as $\mathbf{V} = \nabla \Psi$ if and only if $\nabla \times \mathbf{V} = 0$.
Divergence-free Fields Have Vector Potential
A vector field $\mathbf{V}$ may be written as $\mathbf{V} = \nabla \times \mathbf{A}$ if and only if $\nabla \cdot \mathbf{V} = 0$.
There are no magnetic monopoles as far as we know, meaning that magnetic fields are always divergence free and therefore expresssible as the curl of a vector potential $\mathbf{A}$.
Maxwell's equations tell us that $\nabla \times \mathbf{B} = \mu_0 \mathbf{J} + \mu_0\epsilon_0 \frac{\partial \mathbf{E}}{\partial t}$, where $\mathbf{J}$ is the current density. If the RHS is zero, the magnetic field is zero. This means that if there is a nonvanishing magnetic field, $\mathbf{B}$ has nonzero curl and so cannot be expressed in terms of a scalar potential.
