Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:58:7

Have you not considered that Allah knows what is in the heavens and what is on the earth? There is in no private conversation three but that He is the fourth of them, nor are there five but that He is the sixth of them - and no less than that and no more except that He is with them ˹in knowledge˺ wherever they are. Then He will inform them of what they did, on the Day of Resurrection. Indeed Allah is, of all things, Knowing.  

Have you not seen, ˹have you not˺ realised, that God knows all that is in the heavens and all that is in the earth? Not secret conversation of three takes place but He is their fourth ˹companion˺, by ˹virtue of˺ His omniscience, nor of five but He is their sixth, nor of fewer than that or more but He is with them wherever they may be. Then He will inform them of what they did, on the Day of Resurrection. Assuredly God has knowledge of all things.
القرآن:٥٨:٧

أَلَمْ تَرَ أَنَّ اللَّهَ يَعْلَمُ مَا فِي السَّمَاوَاتِ وَمَا فِي الْأَرْضِ ۖ مَا يَكُونُ مِنْ نَجْوَىٰ ثَلَاثَةٍ إِلَّا هُوَ رَابِعُهُمْ وَلَا خَمْسَةٍ إِلَّا هُوَ سَادِسُهُمْ وَلَا أَدْنَىٰ مِنْ ذَٰلِكَ وَلَا أَكْثَرَ إِلَّا هُوَ مَعَهُمْ أَيْنَ مَا كَانُوا ۖ ثُمَّ يُنَبِّئُهُمْ بِمَا عَمِلُوا يَوْمَ الْقِيَامَةِ ۚ إِنَّ اللَّهَ بِكُلِّ شَيْءٍ عَلِيمٌ  

{ألم تر} تعلم {أن الله يعلم ما في السماوات وما في الأرض ما يكون من نجوى ثلاثة إلا هو رابعهم} بعلمه {ولا خمسة إلا هو سادسهم ولا أدنى من ذلك ولا أكثر إلا هو معهم أين ما كانوا ثم ينبئهم بما عملوا يوم القيامة إن الله بكل شيء عليم}.