Language:
كتاب النكاح
67  
Wedlock, Marriage (Nikaah)
(112)
Chapter: A man should not stay with a woman in seclusion
(111)
باب لاَ يَخْلُوَنَّ رَجُلٌ بِامْرَأَةٍ إِلاَّ ذُو مَحْرَمٍ، وَالدُّخُولُ عَلَى الْمُغِيبَةِ
Sahih al-Bukhari 5233

Narrated Ibn `Abbas:

The Prophet (ﷺ) said, "No man should stay with a lady in seclusion except in the presence of a Dhu- Muhram." A man stood up and said, "O Allah's Messenger (ﷺ)! My wife has gone out intending to perform the Hajj and I have been enrolled (in the army) for such-and-such campaign." The Prophet (ﷺ) said, "Return and perform the Hajj with your wife."

حَدَّثَنَا عَلِيُّ بْنُ عَبْدِ اللَّهِ، حَدَّثَنَا سُفْيَانُ، حَدَّثَنَا عَمْرٌو، عَنْ أَبِي مَعْبَدٍ، عَنِ ابْنِ عَبَّاسٍ، عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ ‏"‏ لاَ يَخْلُوَنَّ رَجُلٌ بِامْرَأَةٍ إِلاَّ مَعَ ذِي مَحْرَمٍ ‏"‏‏.‏ فَقَامَ رَجُلٌ فَقَالَ يَا رَسُولَ اللَّهِ امْرَأَتِي خَرَجَتْ حَاجَّةً وَاكْتُتِبْتُ فِي غَزْوَةِ كَذَا وَكَذَا‏.‏ قَالَ ‏"‏ ارْجِعْ فَحُجَّ مَعَ امْرَأَتِكَ ‏"‏‏.‏
Reference : Sahih al-Bukhari 5233
In-book reference : Book 67, Hadith 166
USC-MSA web (English) reference : Vol. 7, Book 62, Hadith 160
  (deprecated numbering scheme)