How does angular velocity transform on the surface of a sphere?

If we consider the earth as a sphere than it will have an angular velocity of $\boldsymbol{\omega}=\omega\mathbf{e}_z=\frac{2\pi}{T}\mathbf{e}_z$ where $T\approx24h$.

Now we have given a location in spherical coordinates $\mathbf{r}=\left(R, \theta, \phi\right)^\intercal$ which points to the surface of the earth.

We are now given a problem where we should discuss the Coriolis force at that point.

The solution to this problem starts with projecting $\boldsymbol{\omega}$ to a cartesian coordinate system in rest at $\mathbf{r}$ where $\boldsymbol{\omega^\prime}=\left(-\omega\sin\theta, 0, \omega\cos\theta\right)^\intercal$.

I do understand where the $z$-component comes from ($\omega^\prime_z=\frac{\langle\boldsymbol{\omega},\mathbf{r}\rangle}{\Vert\boldsymbol{\omega}\Vert\cdot\Vert\mathbf{r}\Vert}\mathbf{r}=\omega\cos\theta\mathbf{e}_z$) but I do not know how to derive $\boldsymbol{\omega}_x$.

So how can we derive $\boldsymbol{\omega}_x$?

Actoually your $\vec ω'_z$ is also wrong, because $\vec ω'$ is $(-ωsinθ,0,ωcosθ)$ for a different base. No matter what your base is $\vec ω$ is the same vector so $\vec ω = \vec ω'$. You have:

$$\vec ω'_x + \vec ω'_y + \vec ω'_z = \vec ω \Rightarrow \vec ω'_x + \vec ω'_y + ωcosθ \vec e_z = ω\vec e_z \Rightarrow \vec ω'_x + \vec ω'_y=ω(1-cosθ) \vec e_z$$

And that is impossible because $\vec e_x$ and $\vec e_y$ dont have components on $e_z$-direction.

Also the component of $\vec ω$ in the r direction is calculated by:

$$\vec ω_r = \frac{<\vec ω , \vec r>}{||\vec r||^2} \vec r$$

Now we name $\hat r$ as $\hat z$ and we construct an orthonormal system as it is shown in the picture bellow. According to this base,

$$\vec ω_x = 0 \hat x$$ $$\vec ω_y = -ωcosθ \hat y$$ $$\vec ω_z = ωsinθ \hat z$$

$$\vec ω = (0, -ωsinθ , ωcosθ)$$

What i would also like to point out is that you say that $$\vec ω = (-ωsinθ,0,ωcosθ)$$

That means that what i have defined as x axis you have defined as y and vice versa. The thing is that you usually define the orthonormal system Oxyz so as that $$\hat x \times \hat y = \hat z$$

The way you have defined the system is such that

$$\hat x \times \hat y = - \hat z$$

That might create some problems, so I would encourage you to follow the first way (the one that I presented) of defining the orthonormal system.