Ruqyah through the Quran, Names of Allah, and Duas etc. is permissible (although there are minority madhabs that consider it makruh, or makruh with with some exceptions).
Evidence for it being permissible includes the verse of the Quran:
وننزل من القرآن ما هو شفاء ورحمة للمؤمنين
And We send down of the Qur'an that which is healing and mercy for the believers
— Quran 17:82
And the narrations that the Prophet ﷺ himself performed it, it was performed on him, and he approved of it being performed by the Sahaba:
عن عائشة، قالت كان رسول الله صلى الله عليه وسلم إذا مرض أحد من أهله نفث عليه بالمعوذات فلما مرض مرضه الذي مات فيه جعلت أنفث عليه وأمسحه بيد نفسه لأنها كانت أعظم بركة من يدي
It was narrated that 'Aishah said: "If one of his family fell sick, the Messenger of Allah ﷺ would blow over him and recite Al-Mu'awwidhât. When he fell sick with his final illness, I started to blow over him and wipe him with his own hand, because it was more blessed than my hand.
— Sahih Muslim
عن عائشة، زوج النبي صلى الله عليه وسلم أنها قالت كان إذا اشتكى رسول الله صلى الله عليه وسلم رقاه جبريل قال باسم الله يبريك ومن كل داء يشفيك ومن شر حاسد إذا حسد وشر كل ذي عين
It was
narrated from 'Aishah, the wife
of the Prophet , that she said:
"When the Messenger of Allah
fell sick, Jibril, would
recite Ruqyah for him, saying: 'In
the Name of Allah, may He cure
you, from every disease may He
heal you, from the evil of the
envier when he envies and from
the evil of every evil eye.'
— Sahih Muslim
لدغت رجلا منا عقرب ونحن جلوس مع رسول الله صلى الله عليه وسلم ، فقال رجل : يا رسول الله ، أرقي ، قال : من ا ستطاع منكم أن ينفع أخاه فليفعل
A man was stung by a scorpion when
we were sitting with the Messenger
of Allah , and a man said: "O
Messenger of Allah ﷺ, shall I recite
Ruqyah?" He said: 'Whoever
among you can benefit his brother,
let him do so.'
— Sahih Muslim
فأتى النبي صلى الله عليه وسلم فذكر ذلك له فقال يا رسول الله والله ما رقيت إلا بفاتحة الكتاب فتبسم وقال وما أدراك أنها رقية ثم قال خذوا منهم واضربوا لي بسهم معكم
... So he came to the Prophet ﷺ
and told him about that. He said: "O Messenger of Allah, by
Allah, I did not recite anything
but the Opening of the Book as
Ruqyah for him." He smiled and
said: "How did you know that it
is a Ruqyah?" Then he said:
"Accept (the sheep) from them
and give me a share with you."
— Sahih Muslim
Various explanations have been given for the hadith you have quoted:
It refers to non-Islamic Ruqyah , such as that practiced in Jahiliyyah. Spells which rely on other than supplication to Allah, or cryptic incantations whose meaning is unknown, or any Ruqyah done with the belief that the words themselves or the person causes the healing rather than Allah.
اعرضوا على رقاكم لا بأس بالرقى ما لم يكن فيه شرك
Present your Ruqyah to
me. There is nothing wrong with
a Ruqyah that does not involve
Shirk.
— Sahih Muslim
It refers to purposefully asking others to do Ruqyah for you, because you depend on that person rather than on Allah, which is against Tawakkul.
It refers to doing Ruqyah while healthy, from intense fear of falling into sickness, which is again contrary to Tawakkul.