The eventual question will be whether a pin White can inflict will work, but first let's take stock of the position. White has a mating threat in Qa5; it’s a classic case of the queen and a backup piece trained on a square adjacent to the king. But White has other problems of his own to address. One of your jobs is to be aware of any unprotected pieces on the board—on either side, and at all times. A moment ago White failed to do that here; he left his knight unguarded, perhaps thinking it was safe because it was not under attack. Black saw that this left him an opening for a queen fork: there was a square—f1—from which the queen could both attack the knight and give check. So Black played Qf1+ and White now has to move his king or interpose his bishop or rook in front of it, after which Black will take his knight. But which should it be: move the king or interpose?
The important thing for White is to not just think that his knight is about to be taken, but to see it taken in his mind’s eye and imagine the board as it then would look—and in particular to see that Black’s king and queen would be on the same diagonal. (Or simply notice that they already are on the same line and are about to come closer together.) So White looks ahead and imagines replying to QxN with a pin of the queen via Bd3. The bishop would need protection, but White could supply it with his rook on the d-file. So thinking backwards, he considers now playing Rd1, interposing the rook to block the check and keeping it where it can supply backup for the coming pin. He doesn’t want to move his king to a2, since then it gets checked again when Black plays QxN.
Well and good, but will the pin work? All the basic elements would be there, but White must go farther and ask about Black’s response. He doesn’t have to worry about Black’s queen doing any harm; it will be paralyzed on c4. But he does have to worry about whether any other Black pieces would be able to check his king. Here the answer is yes: once White’s bishop moves to d3, Black’s pawn on c3 will be poised to fork White’s king and rook with c3-c2. If the king moves, the rook gets taken and the pawn promotes, inflicting yet another check. White’s other option is to get rid of the pawn with Bxc2—but then the pin of Black's queen disappears. So White’s pinning idea doesn’t work after all. (Starting with the interposition Bd1 isn’t much better, mind you; Black has c3-c2+, to which White replies Kxc2; then Black plays QxN+.)
The simple lesson: never fail to ask whether your opponent would be able to disrupt your plans and above all whether he can do it with check.