Any good deed, be it salat, sawm, zakat, hajj, infaq, birrul walidain (dutiful to parents), etc. is not possible to be accepted by Allah SWT if it is not based on tawheed which is clean of shirk. No matter how much good deeds a person does it still has no meaning if he is not kufr towards thaghut, while a person is not said to be having iman towards Allah if he is not kufr towards thaghut and there will be no reward for him.
You already know the meaning of kufr towards thaghut, together with the thaghuts towards whom we must be kafir. "Kufr towards thaghut" and "Iman towards Allah" are two things with which people can be said to be Mu'min and with which good deeds could be accepted, Allah Ta’ala says:
“Whoever does righteousness, whether male or female, while he is a believer (Mu'min) - We will surely cause him to live a good life, and We will surely give them their reward [in the Hereafter] according to the best of what they used to do.” (An-Nahl: 97)
In this verse, Allah SWT sets the rewards of the good deeds to be only for the Mu'min, while the people who are keen on making tumbal (Javanese - s.t. used to prevent disease or misfortune/protective agent), ritual offerings, asking from dead persons or promoting secularism, liberalism, democracy or nationalism and other shirk system of philosophy, they are not Mu'min, but they are mushrik, because they are not kufr towards thaghut, that the salat, sawm, zakat and other ibaadahs that they do are not valid and there will be no reward.
Allah Ta’ala also says:
“Whoever does righteousness, whether male or female, while he is a believer (Mu'min) - those will enter Paradise, being given provision therein without account.” (Ghafir/Al-Mu'min : 40)
In this verse, Allah SWT sets the reward of going to heaven for the people who do good deeds on the condition that they are Mu'min, whereas the bearers of Pancasila, Democracy and the man-made UUD (Constitution) are not said to be Mu'min, because they are not kufr towards thaghut, but they are precisely the servants of thaghut.
Also in His verse:
“And whoever does righteous deeds, whether male or female, while being a believer (Mu'min) - those will enter Paradise and will not be wronged, [even as much as] the speck on a date seed.” (An-Nisa: 124)
In this verse, Allah SWT specifies the reward of heaven for the people who do good deeds, on the condition that they are Mu'min, while the apparatuses of the thaghut, the slaves of democracy, the servants of Pancasila, man-made UUD and the kafir government, they are not Mu'min, because they are not kafir towards thaghut, in fact they become the shelter and fortress of the thaghut.
Also in His verse:
“But he who does of righteous deeds while he is a believer (Mu'min) - he will neither fear injustice nor deprivation.” (Thaha: 112)
This is different from the mushrik and kafir, they do not get anything from the good deeds that they do.
Also in His verse:
“So whoever does righteous deeds while he is a believer (Mu'min) - no denial will there be for his effort, and indeed We, of it, are recorders.” (Al-Anbiya: 94)
Whereas, the authorities of the shirk system and their officials, as well as their members of parliament, are not the Mu'min but they are the Thaghut.
All the verses imply iman for the acceptance of good deeds, while the worshippers of the graves or stones or sacred trees or the bearers of democracy or the man-made laws or the shirk philosophies (such as the Pancasila, and man-made Constitution/UUD) or the security apparatus of the thaghut rulers, are not the people who are kafir towards thaghut.
Therefore, where do their good deeds go to? Then, the answer is; gone, disappeared and wasted, just as Allah SWT says:
“If you should associate [anything] with Allah , your work would surely become worthless, and you would surely be among the losers.” (Az-Zumar: 65)
Those many good deeds will be lost in vain just by doing shirk once, then how in the world it would be if the people are constantly walking upon shirk, but this verse was a threat to Rasulullah SAW who is impossible to be committing shirk. And the same goes with all the other prophets, they are all threatened with the similar threat. Allah Ta’ala says:
“But if they had associated others with Allah, then worthless for them would be whatever they were doing.” (Al-An’am: 88)
Yes, vanishing like ashes which are swept away by the typhoon, just as Allah Ta’ala says:
“Their deeds are like ashes which the wind blows forcefully on a stormy day.” (Ibrahim: 18)
Allah also likens the good deeds of the kafir to a mirage:
“But those who disbelieved - their deeds are like a mirage in a lowland which a thirsty one thinks is water until, when he comes to it, he finds it is nothing but finds Allah before Him, and He will pay him in full his due; and Allah is swift in account.” (An-Nur: 39)
The mushrik people, when they perform salat, zakat, sawm, etc. think that their rewards with Allah are many, but when they are resurrected it will turn out that they don't get anything but ‘adzab!
In other verse, their good deeds are like scattered dusts:
“And We will regard what they have done of deeds and make them as dust dispersed.” (Al-Furqan: 23)
Indeed… they are really losers, as mentioned in another verse:
“Say, [O Muhammad], 'Shall we [believers] inform you of the greatest losers as to [their] deeds? [They are] those whose effort is lost in worldly life, while they think that they are doing well in work.'” (Al-Kahfi: 103-104)
Yes, they are truely losers because they are tired, worn-out, drained, working hard, as well as striving for the good deeds, but it turns out that they don't get anything because they do not have the tawheed. Allah Ta’ala says:
“Working [hard] and exhausted, They will [enter to] burn in an intensely hot Fire.” (Al-Ghasyyiah: 3-4).
This (tawheed) is the most fundamental requirement which is rarely noticed by many people. There are still two more conditions which are related to the acceptance of good deeds, namely ikhlas and mutaba’ah. And here is the brief explanation:
1. Ikhlas (Sincere)
Those who do righteous deeds, but are not sincere, and only because of wanting to be seen or heard by other people, then those deeds are not accepted by Allah SWT, like what He says:
“So whoever would hope for the meeting with his Lord - let him do righteous work and not associate in the worship of his Lord anyone.” (Al-Kahfi: 110)
This verse is about ikhlas, so the people who do good deeds and they mean those deeds for others beside Allah, then they are not ikhlas.
Rasulullah SAW said in a hadith qudsi: “That Allah says: ‘I am the One Who does not want an ally the most, whoever does good deeds where he is associating others with Me, then I leave him with his association.'” (HR. Muslim)
2. Mutaba’ah (in accordance with the guidance of the Rasul)
Acts of worship, even if exercised with ikhlas but if it is not in accordance with the guidance of Rasulullah SAW, then they will definitely be rejected.
He SAW said: “Whoever does good deeds that do not have any basis from us, then it is rejected.” (HR. Muslim)
He SAW also said: “Stay away from matters that are made up because every made up matter (in ibaadah) is bid’ah, and every bid’ah is misguidance.” (HR. At Tirmidzi)
A few good deeds but upon Sunnah are better than many good deeds in bid’ah. Ibnu Mas’ud RA said: “Follow (the guidance of Rasulullah) and do not make up anything new.”
Therefore, in the matter of ibaadah, we have to ask ourselves: “What is the basis or daleel that we use as the foundation? For whom do we do the good deeds?” When we do not know the basis then leave it because it is safer for us.