What is one to do if he heard Kaddish in middle of Shemoneh Esrei:
It is forbidden to answer even Kaddish in the midst of Shemoneh Esrei. Rather, one is to [stop reciting Shemoneh Esrei and] remain silent [and listen] and concentrate to the words of the Chazan. Doing so is considered as if one is answering the words, as listening is like answering in all places [of Halacha].
Until when is one to remain silent by Kaddish: When the Chazan [or other individual saying Kaddish] reaches the words Yisbareich and Yishtabach, he may return to his Davening.
One who hears Kaddish in the midst of Shemoneh Esrei is to remain silent and concentrate on the words of the Chazan until the Chazzan reaching the words Yisbareich.
 Admur 104:5; Michaber 104:7; Tur 104:7
 Admur ibid; Michaber ibid; Brachos 21b
Other opinions in Talmud: Some opinions rule that while one does not make an interval for Kedusha or Modim, one is to stop to answer Amein Yihei Shmei Raba. [Students of Rebbe Yochanon in Brachaos ibid] We do not rule like this opinion. [Brachos ibid]
 Admur ibid; Michaber ibid; Tur ibid in name of Rabbeinu Chananel; Tosafus Brachos ibid that so is the custom; Rashi Sukkah 38b; Bahag Brachos ibid; Haeshkol p. 31 in name Rav Haiy Gaon; Ran 19b; Ravayah; Bach 104 in name of Mordechai and that so is custom; Levush 104; Soles Belula 104:2; Chayeh Adam 25:10; Beis Oved 57; Kitzur SHU”A 18:14; Ben Ish Chaiy Mishpatim 5; Kaf Hachaim 104:36
Other opinions: Some Poskim rule one is to continue Davening, as hearing is like answering, and is considered a Hefsek. [2nd opinion in Tur ibid in name of Rabbeinu Tam and Ri; Tosafus Brachos ibid in name of Rabbeinu Tam and Ri and Geonim; Hagahos Maimanis Tefila 10; The Rosh Brachos 18 and Rabbeinu Yona 13b bring both opinions and give no arbitration; See Beis Yosef 104:7] Other Poskim rule that although it is not considered a Hefsek, one is not Yotzei being that he is not allowed to speak, and hence there is no point of stopping to listen. [Darkei Moshe 104:1 in name of the Iggur that the custom of the Ashkenazi Rabbeim is not to stop and listen; Beis Yosef 25 in name of Rashba and Iggur; Shagas Aryeh 6 in name of Shivlei Haleket; Abudarham, brought in Erech Hashulchan 104:3 and 55:1; See P”M 104 A”A 7] Due to the above opinions. Kaf Hachaim ibid concludes that if stopping to listen will ruin one’s concentration of the prayer, or if he anyways cannot hear the Chazan properly, then one may continue his Davening and rely on the other opinions.
The first blessing: The above ruling applies even if one is in the first blessing of Magen Avraham. [Setimas Kol Haposkim; Halichos Shlomo 8 footnote 57 in name of Rav SZ”A, unlike Teshuvos Vehanhagos 1:76, based on Biur Halacha 101 in name of Rashba]
 The reason this is not considered a Hefsek: Nonetheless, this is not considered a Hefsek in Shemoneh Esrei since he is not verbalizing the words with his mouth. [Admur ibid] See, however, other opinions in previous footnote.
Other opinions: See other opinions in previous footnote that one is not Yotzei.
 Admur ibid; M”A 104:7; Bahag ibid; M”B 104:26
Other opinions: Some Poskim rule one is to stop and listen until the end of Demarian Bealma. [Machatzis Hashekel on M”A ibid, in his understanding of M”A; Kaf Hachaim 104:38 that so is to be followed by those who rule like the Arizal and answer Kaddish until Demaran Bealman; Az Nidbaru 3:67; Piskeiy Teshuvos 104:13]