All perfect praise be to the Lord of The Worlds.
Supplication is a means, just as seeking provision is a means to provision, marriage is a means to begetting children and adherence to offering acts of devotion is a means to getting admitted to paradise. Since all of these are a means to an end, whoever doesn`t undertake them won`t achieve the end that he aspires to, and this doesn`t contradict with believing in divine decree.
An example on this is that of the teacher who orders his students to study hard in order to pass the exam and get the certificate while he knows the hardworking from the poor. It isn`t permissible that they be rewarded based on the teacher`s pre-knowledge of their abilities; rather, it should be based on the means-the exam.
Al-Imam Al-Ghazali (May Allah have mercy on him) said: "If it was said: "what is the point in supplicating while what is decreed can`t be prevented? You should know that preventing affliction with supplication is part of divine decree because supplication is a means to preventing affliction and the existence of mercy. It is similar to the shield which is a means to pushing an arrow away and water which is a means to the growth of plants. The relationship between supplication and affliction is similar to that between the shield and the arrow for Allah Has Decreed every matter and its means. And Allah Knows Best.