Linear three-dimensional instability of a magnetically driven rotating flow