Hudhur al-qalb in prayer means to liberate the heart from everyone except the person you are speaking to, that is in the case of prayer to pay complete attention to it and the words that are being said and to once more focus on prayer when one finds himself drifting away. The things that are in opposition with hudhur al-qalb are thoughts regarding personal and material matters, in contrast to things that are related to earning God’s favor which are as a matter of fact in harmony with the essence of ibadat (worship) and actually consolidate it.
The great figures of our religion have introduced many methods for attaining khushu (humbleness) and hudhur al-qalb in prayer such as: insightful knowledge of God and this physical world, not paying attention to scattered thoughts and not giving in to distractions, choosing a certain and special place for prayer and worship, refraining from sin, familiarity with the meaning of the words used in prayer and the philosophy lying behind the different parts of the prayer, performing the recommended rituals (mustahabat) and adab (special manners) of prayer and persistently exercising hudhur al-qalb.
 Banu Amin, Tafsir Makhzanul-Irfan, vol. 1, pg. 103.
The presence of the heart ( hudhur al-qalb ) is a very essential aspect of prayer that must be achieved through strong striving and effort. Someone who has wasted most of his life doing wasteful and worthless things is never going to be able to have hudhur al-qalb in prayer, for whatever one occupies himself with will appear to the mind and pose itself when praying. And that’s when no matter how hard he tries to focus on his prayer his imagination starts to run about and his thoughts quickly shatter his focus. However, on the contrary, if a person devotes himself to staying in the framework of Islam and the intellect and keeps in mind God’s satisfaction in every aspect of his life (because if you think about it, you will agree that whatever does not contain God’s satisfaction is worthless and vain) he will definitely be capable of pushing aside any interrupting thought that arises and maintain his heart’s presence in prayer and consequently become humble, due to the tendency he has developed towards Allah. 
Hudhur al-qalb in prayer means to not allow thoughts that have to do with material matters, whether they are personal or pertaining to others, and in general, thoughts that are in contradiction with the hereafter to enter one’s mind. But thoughts that conform to the nature of Ibadat (worship) do not disturb hudhur al-qalb in anyway. So it is safe to say that this is a personal thing where everybody should be their own judge when it comes to saying whether a thought distracts their heart or not. The presence of the heart (hudhur al-qalb) in prayer has its levels and those who have reached the highest levels have completely forgotten and turned their backs on everything except Allah.
The great figures of our religion have introduced many methods for attaining khushu (humbleness) and hudhur al-qalb in prayer that can be helpful: 
1. Acquiring deep and insightful knowledge that makes God greater in one’s eyes and this material world less significant so as a result nothing related to this world will be able to distract him when speaking to his lord. Meaning, a person who wishes to stand before God in prayer should have a proper outlook towards his Lord and understand whom he is facing. Allah, the Almighty, is the possessor of all perfections and can be defined as perfection itself. One of such flawless attributes possessed by Him is His divine wisdom, through which no action is performed in vain or without reason. In other words, every action carried out by Allah is with purpose and reason. Through His divine wisdom, Allah has created this world and placed mankind, His best of creations, upon it. The purpose behind man’s creation is for him to reach perfection and spiritual completion. This aim cannot be reached nor this perfection achieved by any other means besides the right path (Siratul Mustaqim) which Allah Himself has placed before man. This path is the path of servitude and submission to God. Allah says in the Holy Quran: “ وَ أَنِ اعْبُدُونی هذا صِراطٌ مُسْتَقیم ”, meaning, “Worship me. That is a straight path.” Meaning, one should obey the instructions and laws which have been divinely instated by Him – amongst which the most important and highest of them comes in the form of worship.
A person who does not understand the philosophy and rationale behind worship will fail to reap any benefits from it. In order to acquire this understanding, one must asses worship through the lens of religion and faith.
2. Attending to scattered and different tasks usually distracts one from being focused and the more one is able to get rid of distracting and scattered thoughts the more he can concentrate when praying.
3. Specifying a place for prayer and worship can also help, which is exactly why praying in front of objects that cause distraction is makruh, it is also makruh to pray in front of an open door and passages, before a mirror and pictures and so on. This explains why the more simple a mosque is built the easier it will be to have hudhur al-qalb.
4. Abstaining from sin is a pivotal element because sins separate us from God.
Care must be taken to first abstain from harmful practices, namely, sins. It has been narrated that one should avoid sins and transgression to the highest extent possible, because it is those sins which penetrate a person’s heart and render their worship futile. “ اذا اذنب الرجل دخل فی قلبه نقطة سوداء .”
Imam Sadiq (as) states: My father [Imam Baqir] stated: nothing is more harmful to the heart than sin, which penetrates the heart and grapples with it; finally sins dominate the heart and leave it ravaged. 
Meaning, a person’s heart is initially pure and aware of God, however, it is prone to being dominated and laid to waste by sins, which leave the heart plagued and wic k ed.
Imam Sadiq (as) states:It is sins that hold a person back from partaking in worship and night prayers, preventing one from communing with God and the joy that accompanies it, for the effects of sins are quicker than that of a keen blade.  , 
5. Becoming familiar with the meaning of the words used in prayer and learning the philosophy and rationale behind its different parts is very important.
6. Recommended rituals (mustahabat) and adab (special manners) of prayer, both before and while praying can be very helpful.
7. Having said all of what was said, this task requires a lot of prolonged practice, persistence and
. It is very common that at the beginning one might simply be able to stay focused in his prayer for a few seconds but after striving and struggling they will reach a point of strength in themselves and focus where, while praying, they can block out everything and remember God Almighty.
 Tafsir Makhzanul-Irfan, vol. 9, pg. 9.
 Tafsir Nemouneh, vol. 14, pp. 205-206.
 Al-Kafi, vol. 2, pg. 268 “کان أبی (ع) یقول: ما من شیء أفسد للقلب من خطیئة، إنّ القلب لیواقع الخطیئة فما تزال به حتّى تغلب علیه فیصیّر أعلاه أسفله”
 Al-Kafi, vol. 2, pg. 272 “ إنّ الرّجل یذنب الذّنب فیحرم صلوة اللّیل و إنّ العمل السّیّئ أسرع فی صاحبه من السّکّین فی اللّحم ”.
 With help from Question 7904 (website: 8012).