A Muslim should concentrate in his Prayer and never stop it except for necessity. Elaborating on the issue of stopping Prayer when there is a knock on the door, the late Muslim scholar Sheikh ibn Baz, the former mufti of Saudi Arabia wrote:

If a Prayer is nafl (supererogatory), there is more room for maneuver, and it is permissible to stop praying in order to find out who is at the door. But in the case of a fard (obligatory) Prayer, it is not permissible to stop it unless there is something important that one is afraid of missing. If it is possible to alert someone else by saying “Subhan Allah” out loud in the case of men and clapping in the case of women, so that the person at the door will realize that the person in the house is busy praying, that will do away with any need to stop praying. The Prophet (peace and blessings be upon him) said: “Whoever is alarmed by anything while praying, let men say ‘Subhan Allah’ and let women clap” (Agreed upon).

If it is possible to let the person who is at the door realize that the person inside the house is praying, by clapping in the case of women and saying “Subhan Allah” in the case of men, while still praying, this will save you from having to stop the Prayer. If that will not work, because one is too far away from the door or the person outside will not be able to hear, then it is permissible to stop the Prayer if necessary, especially if it is a nafl Prayer. But in the case of an obligatory Prayer, if it is something important or necessary, and there is the fear of missing it, it is also permissible to stop the Prayer, and to repeat it from the beginning.