The rotation matrix, $R$, can be found relatively easy, such that,
$$
R\,\vec{a} = \vec{d}; \quad R\,\vec{b} = \vec{e}; \quad R\,\vec{c} = \vec{f}.
$$
The rotation matrix/second-order-tensor can be constructed by adding three dyads,
$$
R = \vec{d}\vec{a} + \vec{e}\vec{b} + \vec{f}\vec{c}.
$$
When using this notation the multiplication with a vector should be written as a dot product. From this it can also be proven that this expression for $R$ is correct. For example with mapping $\vec{a}$ to $\vec{d}$, the first dyad will return $\vec{d}\vec{a}\cdot\vec{a}$ and since $\vec{a}$ is normalized that is equal to $\vec{d}$. The remaining dot products will yield zero, because the other vectors on the right side of each dyad is orthogonal to $\vec{a}$.
Each dyad can also be written as a 3$\times$3 matrix using the vector direct product. The total 3$\times$3 rotation matrix can then be constructed by adding the three 3$\times$3 matrix from the vector direct products.
The axis of rotation is equal to the eigenvector of the eigenvalue equal to one. For finding this eigenvector you can take a look at the answer to this question. In order to find the axis of rotation you have to calculate the following matrix,
$$
R-R^T =
\begin{bmatrix}
0 & \alpha & \beta \\
-\alpha & 0 & \gamma \\
-\beta & -\gamma & 0
\end{bmatrix},
$$
such that the normalized axis of rotation, $\vec{r}$, is equal to,
$$
\vec{r} = \frac{
\begin{bmatrix}
-\gamma & \beta & -\alpha
\end{bmatrix}^T
}{\sqrt{\alpha^2 + \beta^2 + \gamma^2}}.
$$
The angle of rotation, $\theta$, can be found according to,
$$
\text{Tr}(R) = 1 + 2\cos\theta,
$$
where $\text{Tr}(R)$ is the trace of $R$, the sum of its diagonal elements. Due to the cosine you do have to look at the sign of the angle and direction of $\vec{r}$.
When one of the two vectors is $0$, the angle between them is not defined.
One way to look at this is that the zero vector doesn't really have a "direction". If a vector $v$ is non-zero, then the direction of that vector can, in some sense, be represented by the vector $\frac{v}{\|v\|}$, and $\frac{0}{\|0\|}$ is not defined. And since the angle between two vectors is really the angle between their directions, it makes sense you can't plug a $0$ vector into the equation.
However, you can still say that the vectors are orthogonal, because their dot product is $0$ - the zero vector, therefore, is orthogonal to every other vector (including itself).
Best Answer
EDIT (my original answer was incorrect)
To see why your solution is not correct, I will consider a simpler example. Let $a_1 , a_2$ be such that $span\{ a_1 , a_2 \} = span \{ (1,0,0,0) , (0,1,0,0) \}$. Let $x=(0,0,1,0)$. Then any vector that is perpendicular to combinations of $a_1 , a_2$ is of the form $y = (0,0, y_3 , y_4)$. I will show that your solution can lead to different answers:
If you found that $y = (0,0,1,0)$, then $\cos \varphi = \langle y,x\rangle /(\|y \| \| x \|)=1$
If you found that $y = (0,0,1,1)$, then $\cos \varphi = \langle y,x\rangle /(\|y \| \| x \|)=1/\sqrt{2}$
To see why the linked answer is correct, notice that they simply compute the orthogonal projection of $x$ onto $span \{ a_1 , a_2 \}$. Denote this projection $y$. Then the angle between $x$ and $y$ is exactly what you are looking for. Note that in order to compute the projection, you need an orthonormal basis (this is how projection is defined)