The gemara makes a distinction between korbanos and gittin. In the context of kodshim we are willing to say that even if one didn't have explicit intent to slaughter the animal li'shma, we consider stam to also be li'shma. However, a woman who is not considered to be pending divorce (and even when she is forbidden to her husband, she can stay married just not have relations - tosafos), therefore stam is not considered li'shma.
To fully understand this concept, there is a basic chakira that opens up the sugya. Is there a requirement of li'shma, or is their a p'sul of it being done she'lo li'shma? If li'shma isn't a requirement, rather shelo lishma is a p'sul, it is obvious that stam would qualify as lishma simply because there is no demand of being lishma. However, if there is a positive requirement of li'shma, the only rationale to consider stam to be li'shma is that there is a subconscious intent of li'shma even though he was never cognisant of it - the intent that he would have had, if he was paying more attention qualifies as li'shma.
The Steipler proves that the approach of saying that there is a subconscious intent of lishma doesn't work because the gemara 3a says that if it is done for the sake of chulin, it is kasher - דלאו מינה לא מחריב בה. Meaning, that since chulin intent is so foreign we consider it as if there is no intent at all, so it defaults to being stam which we consider to be lishma. Clearly, when he is intending for chulin there is no subconscious intent for a korban, yet we apply stam lishma. This indicates that the reason why stam works is because there is no positive requirement of lishma, so long as it is not done she'lo lishma. According to this, it is difficult to understand why there is a difference between gittin where stam isn't lishma and kodshim where stam is lishma. If we assume that lishma isn't a requirement, why would there be a difference? One possibility is to fundamentally distinguish between gittin and kodshim. By gittin there is a positive requirement of lishma and therefore stam doesn't work, but by kodshim there isn't a positive requirement, therefore stam works. This doesn't seem to be the distinction of the gemara. The gemara says - זבחים בסתם לשמן עומדין, אשה בסתמא לאו לגירושין עומדין. The distinction seems to be between the case of kodshim vs. gittin, not a halachic distinction in what the requirement is. Therefore, we must say that both by gittin and by kodshim, there is no requirement for positive intent of lishma. What is the distinction? We consider stam to be completely parve, but the situation has to compensate for the lack of intent. Therefore, an animal of hekdesh that is pending being brought as a korban can fill the void of intent, but a woman who is not pending divorce can't fill the void of intent. According to this, the rationale for stam being lishma is that the situation can compensate for the lack of intent, just as we find by eating cheilev as a mis'aseik where the enjoyment fills the void left by the lack of intent.
The Steipler then questions the mechanics of shelo lishma. In order for the korban which is standing to be brought as a korban to fill the void of lishma, the void must be left empty (parve), but if it is filled with an explicit intent of shelo li'shma, the fact that it is pending to be a korban can't make up for the lack of lishma - in short, we require either lishma or it to be compensated for by the korban, so when it is done shelo lishma, the p'sul is that it is a lack of lishma. Or perhaps there is literally no din of lishma at all. The problem with shelo lishma is not that it undermines the lishma, or prevents the animal pending to be a korban from filling the void of intent. Rather, shelo lishma is an independent p'sul just as pigul is an independent p'sul unrelated to any positive demands. The Brisker Rav (Ma'aseh Korbanos 4) and his father Rav Chaim (quoted by steipler) assume the second possibility, that since we allow stam, we clearly don't require lishma. Therefore, shelo li'shma must be an independent p'sul, not a problem of lacking lishma.
The Steipler proves that both rashi and tosafos are against the Brisker Rav and Rav Chaim . Rashi 3a says that when one slaughters a chatas for a shelamim it is passul becasue - דמינה מחריב בה - דבר שהוא מינו מועיל בה לעקור את שמו. Rashi implies like the first approach that we do require lishma, just that normally when left parve, the fact that it's pending to be a korban can make up for the lack of intent. But when the lishma is totally undermined and ruined by a thought of shelo lishma, the korban is invalid. We also see this from Tosafos in menachos 42b who compares the just as a korban mincha that is done both lishma and shelo lishma is passul, so too when tzitzis is made lisheim tzitzis and shelo lishma it is passul. By tzitzis there is definitely a positive requirement of lishma, so if we assume that by korbanos there is no positive requirement of lishma just a p'sul of lo lishma, we can't prove that tzitzis is passul from korbanos since the positive requirement of lishma was fulfilled. Tosafos must hold that even by korbanos there is a positive requirement of lishma, which is being undermined when there is a thought of shelo lishma.