הַשּׁוֹחֵט לְשֵׁם קֳדָשִׁים שֶׁמִּתְנַדְּבִים וְנוֹדְרִים כְּמוֹתָם, אֲפִלּוּ הִיא בַּעֲלַת מוּם, שְׁחִיטָתוֹ פְּסוּלָה, שֶׁזֶּה כְּשׁוֹחֵט קֳדָשִׁים בַּחוּץ. שָׁחַט לְשֵׁם קֳדָשִׁים שֶׁאֵינָם בָּאִים בְּנֶדֶר וּנְדָבָה שְׁחִיטָתוֹ כְּשֵׁרָה . כֵּיצַד, הַשּׁוֹחֵט לְשֵׁם עוֹלָה, לְשֵׁם תּוֹדָה, לְשֵׁם פֶּסַח, שְׁחִיטָתוֹ פְּסוּלָה. הוֹאִיל וְהַפֶּסַח יָכוֹל לְהַפְרִישׁוֹ בְּכָל שָׁעָה שֶׁיִּרְצֶה, דּוֹמֶה לְנִדָּר וְנִדָּב. שָׁחַט לְשֵׁם חַטָּאת, לְשֵׁם אָשָׁם וַדַּאי, לְשֵׁם אָשָׁם תָּלוּי, לְשֵׁם בְּכוֹר, לְשֵׁם מַעֲשֵׂר, לְשֵׁם תְּמוּרָה, שְׁחִיטָתוֹ כְּשֵׁרָה. וְאִם נוֹדַע שֶׁעָבַר עֲבֵרָה שֶׁחַיָּב עָלֶיהָ חַטָּאת אוֹ אָשָׁם, וְאוֹמֵר זוֹ לְחַטָּאתִי אוֹ לַאֲשָמִי, פְּסוּלָה.
A slaughter for the sake of holy sacrifices, offering as a sacrifice that is offered as a donation or to fulfill a vow, even if the animal has a deformity (and would not be a valid sacrifice), the slaughter is invalid (and not kosher even as a non-sacrificial meat), because it is like slaughtering a sacrifice outside of the Temple. However, a slaughter performed for the sake of a holy sacrifice which is not one of them which are offered as a donation or a vow, the slaughter is accepted as kosher.
How is this so? Just like a slaughter done for the sake of a Burnt Offering, a thanksgiving offering, or Passover offering it is invalidated (as these are offered as donations or to fulfill vows).
(Why would the Passover be in this category? Isn’t it an obligation?) Because on Passover we’re able to set aside all the time what we desire, which is similar to a willful vow.
A slaughter for the sake of a sin offering, or a guilt offering, or a first born, or your tithe, or compensation exchanged for another sacrifice, then the slaughter is acceptable as kosher (as a non-sacrifice).
However, if a person knows he committed a sin which would obligate him to offer a sacrifice in the Temple, and he declares this slaughter to be for the sake of his sin offering or his guilt offering, the slaughter is invalid (not kosher).