I will define an $O(\log n)$ solution for X-right direction. The argument can be extended for the other directions also.
Let the input point set is: $(x_i,y_i,z_i)$ for $i \in \{1,\dotsc,n\}$.
Suppose that for the coordinate $(y_i,z_i)$, we have a list of points that have $y = y_i$ and $z = z_i$. There can be at most $n$ such lists. Sort the points in each list by their $x$-coordinates.
When, a query point $(x_q,y_q,z_q)$ comes, perform a binary search in the list defined by $(y_q,z_q)$. This will give you the X-right neighbour of $(x_q,y_q,z_q)$ in $O(\log n)$ time.
The only remaining question is how to create the lists corresponding to each $(y_i,z_i)$, and locating these lists efficiently. For this, maintain a hash table that stores an entry corresponding to every $(y_i,z_i)$. The size of the table is $\Theta(n)$ and the key of the hash function corresponds to the pair $(y_i,z_i)$. Therefore, the lists for every $(y_i,z_i)$ can be created in average $O(n)$ time. Moreover, locating an entry $(y_q,z_q)$ from the hash table also takes $O(1)$ time on average; therefore queries can be answered efficiently.
Create these hash tables and lists for the remaining directions also. The total space complexity is just $O(n)$, and the preprocessing time is $O(n \log n)$ on average.