BUG: Raise error when expr does not evaluate to bool in df.query 
- [X] closes  #8560
- [X] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [X] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [X] Added an entry in the latest `doc/source/whatsnew/v1.5.0.rst` file if fixing a bug or adding a new feature.

Special attention to line 4139 in
https://github.com/pandas-dev/pandas/blob/b8e1aa44771a60899bc57fc8e12ba367088e23e4/pandas/core/frame.py#L4137-L4141

This condition was added in order to pass some special test that used higher dimensions. These tests were

pandas/tests/frame/test_query_eval.py::TestDataFrameQueryNumExprPandas::test_nested_scope
pandas/tests/frame/test_query_eval.py::TestDataFrameQueryPythonPandas::test_nested_scope

This is because these tests produce a  res that evaluates to false in first condition (line 4137)
```python
res =        0      1      2
0   True  False  False
1  False  False  False
2  False  False   True
3   True   True  False
4  False   True   True
```
So in this case we check for column to be bool type


 Sorry for the long delay, I had a couple of hard weeks. But now on I can and will iterate a lot quicker. This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this. Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.