Fundamental theorem of Arithmetic can be interpreted as saying that the set of positive rational numbers under multiplication is a free abelian group with prime numbers as basis.
So one can define an endomorphism of the group by specifying it arbitrarily on primes. (An endomorphism is also a function from rationals to real numbers as required by you)
For example define $f(1)=1, f(p) = p$ for primes less than 100, and
$f(p) = 1$ for primes $ p > 100$, and extend it multiplicatively.
This is in particular not a 1-1 function and satisfies your functional equation and is not of the form $f(x) = x^a$.