Let $f: \mathbb{R} \to \mathbb{R}^d$ be $C^1$ and $L^2$ (I'm not sure at all that the $C^1$ regularity is relevant). I'm trying to find a solution $p : \mathbb{R}^d \to \mathbb{R}^d$ to the following differential system, in the distributional sense $$ \partial_{x_i} p_k = \delta_{ik} f(x), $$ where $\delta_{ik}$ is the Kronecker symbol, $\delta_{ik} = 1$ if $i = k$, $0$ otherwise.
So basically what I want is a function whose divergence is $f$, but such that the other derivatives are all equal to $0$. I've tried numerous approaches, but the fact that $f$ itself depends on $x$ makes the problem highly non-linear. I only need an existence result, I am unsure whether a solution even exists. If a solution exists, I don't need the explicit form of it, although that would be super nice. Any reference or help would be much appreciated.
Let's say $d=2$ for simplicity (higher dimensions work the same way). Distributional derivatives commute, so $$ \partial_1 f=\partial_1 \partial_2 p_2=\partial_2 \partial_1 p_2=0 $$ and similarly $\partial_2 f=0$. Thus $f$ is constant. If you really want $f\in L^2$, this only leaves us with $f=0$, in which case any constant functions $p_1$, $p_2$ solve your system.
If we forget about the condition $f\in L^2$, then we have $f(x)=a$ for some constant $a$, and it is not hard to see that the only solutions are of the form $p_1(x)=a x_1+d_1$, $p_2(x)=a x_2+d_2$ for constants $d_1,d_2$.