Just to be clear it's not if the square is in between the king and rook, it's if the king has to pass through/land on an attacked square. So the answer is yes, a knight can prevent castling, it doesn't matter what the piece is, as long as the square is threatened.
I clarified the first part because another common question is "can the rook pass through a threatened square as long as the king doesn't" and the answer is yes. It only ever has to do with the king passing through a threatened square, regardless of what piece is threatening it.
White to move can castle either direction, black to move can't castle at all.
Forgive me if this question seems obvious to you all: Can a Knight prevent a King from castling if one of its potential moves is a square between the opponents King and Castle? I'm guessing yes, but as it's not a "direct line of fire" (like with a Bishop, Queen, etc) I'm confused. I have never had such a problem before!
Thanks