The hadith "For one of you to be stabbed in the head with an iron needle is better for him than that he should touch a woman who is not permissible for him" was quoted earlier. If anyone's interested, here's an alternative perspective on it (disclaimer: writing from a Sunni background, not a fully qualified scholar, other perspectives exist, Allah knows best).
For background, a hadith is an account of something said or done by The Prophet Muhammad (pbuh) or his companions, passed through a chain of narration/recording. (Side note: much of sharia law is actually derived from hadith rather than the Qur'an). Given the factors which may make an account unreliable after hundreds of years, there are academic processes for evaluating the authenticity of these accounts and only a comparatively small number are considered robustly reliable. When considering the reliability of a hadith, people weigh up the credibility of the entire chain of narrators/recorders, the completeness of documentation, consistency with other evidence, etc. It's not simply a case of something being a hadith automatically being considered factual. Something can be a hadith and be considered a 'weak' hadith.
There is not a universal agreement about the reliability of the hadith quoted. Some scholars consider it to be 'strong' (to have a good enough chain of evidence and historical preservation). Others disagree. There are debates about a potential 'break in the chain' and unreliability of at least one narrator, for example. Some scholars from the Hanafi and Maliki schools (two of the main schools of thought in Sunni Islam) consider that a prohibition is not proven without evidence from the Qur'an and authentic hadiths, consistent with the principle that, in daily life, lawful things are permissible until explicitly stated not to be. Another interesting point about this particular hadith is that, while it is often brought out in modern times, it didn't actually appear to be the basis for rulings about boundaries between men and women in the early Islamic period.
Moving on to the text of the hadith, a key word in the hadith is 'touch', which is a translation of a verb in Arabic arising from the root word 'mass' (mim, seen, seen). While 'touch' is a valid translation, the Arabic word is one which is often used to refer to something more intimate / deeper than a simple handshake - for example, it can be used to mean sexual intercourse. A number of scholars therefore don't consider this hadith to be about ordinary daily interactions at all, but about sexual/intimate interactions.
So, basically, this hadith isn't a universally accepted basis for not working with men. There are also multiple accounts of Muslim women working in mixed sex environments since the time of The Prophet (pbuh), including as scholars, in healthcare, in business, in leadership positions, etc.