can one daven in a place where its was just painted and varnished and there lingers a terrible and foul smell and some people of the minyan deem it to be harmful? what should be the psak in this case?
Answer: If, as you write, the smell is “terrible and foul,” meaning an extremely bad and strong odor, then it would be prohibited to daven in the place. However, if the smell is unpleasant, but not aggressively offensive, it is permitted to daven there.
Sources: See Shulchan Aruch (Orach Chaim 86:1) who rules that one may not daven in a place of standing water and the like, which gives off a very bad smell. Mishnah Berurah (3) quotes from Eliyah Rabbah who writes that the same applies to wine cellars where there is a very bad and musty smell. Although Mishnah Berurah questions this ruling from a ruling of Rambam (Tefillah 4:9) who writes that the “great wise men” used to avoid davening in a room with beer (and the like) which gives off a foul odor, indicating that there is no actual prohibition, Mishnah Berurah elsewhere (227:3) resolves the contradiction by distinguishing between different degrees of bad odors. In fact, the ruling of Eliyah Rabbah is a quote from Tzeida La-derech (1:2:1) and is confirmed by many leading authorities, including Pri Megadim, Machatzis Hashekel, Petach Hadvir, among others, and the solution of the Mishnah Berurah seems fairly clear. Therefore, where a smell is very foul, such as a wine cellar and the like, it is prohibited to daven, but where the bad smell is only faint, it is permitted. The case of the question would appear to match the first category.