Trace over configuration basis Let us take a many-body quantum system, whose phases in the configuration basis are labeled by $\mathbf {\hat q}=(q_1,\cdots, q_N)$ and momenta $\mathbf {\hat p}=\left(-i\frac{\partial}{\partial \hat q_1},\cdots, -i\frac{\partial}{\partial \hat q_N}\right)$. Let us then consider the operator 
\begin{equation*}
f(\mathbf {\hat q}, \mathbf {\hat p})\equiv \hat q_1^{n_1}\cdots \hat q_N^{n_N}\left(-i\frac{\partial}{\partial \hat q_1}\right)^{m_1}\cdots \left(-i\frac{\partial}{\partial \hat q_N}\right)^{m_N}
\end{equation*}
of powers of configurations and positions, $n_i, m_i\in \mathbb N^0$.
Is it correct that the object 
\begin{equation*}
\tilde{\mathrm{tr}}\left\{f(\mathbf {\hat q}, \mathbf {\hat p})\right\}\equiv\int_{\mathbb{R}^N} \mathrm d\mathbf {\hat q} \left\langle\mathbf q\middle|f\left(\mathbf {\hat q} ,-i\frac{\partial}{\partial {\mathbf {\hat q} }}\right) \middle|\mathbf q\right\rangle
\end{equation*}
is NOT defined (i.e. it is not a well posed trace)? 
In particular, for infinite-dimensional Hilbert spaces $H$, an operator is trace class if it is bounded. In my case this is not supposed to be the case, as
\begin{equation}
\sup_{|\mathbf q\rangle\in\mathcal D(H), ||\mathbf r||\neq 0}\frac{||f\left(\mathbf q,-i\frac{\partial}{\partial {\mathbf q}}\right) |\mathbf q\rangle ||}{|| |\mathbf q\rangle ||}=+\infty
\end{equation}
where $\mathcal D(H)$ is the (unbounded) domain in the Hilbert space of definition of the operator; in particular, $\hat f$ is the product of powers of unbounded operators.
Instead, in case one includes a canonical weight and defines
\begin{equation*}
\mathrm{tr}\{e^{-\beta\hat H}f(\mathbf {\hat q} ,\mathbf {\hat p} )\}\equiv \int_{\mathbb{R}^N} \mathrm d\mathbf {\hat q}  \left\langle{\mathbf{\hat q}} \middle|e^{-\beta\hat H}f\left(\mathbf {\hat q} ,-i\frac{\partial}{\partial {\mathbf {\hat q} }}\right) \middle|\mathbf {\hat q} \right\rangle
\end{equation*}
is the equation above a well defined trace?
 A: I'll give it a shot. Since this is a many particle configuration, we have that $[q_i, q_j] = 0$ and $[p_i, p_j]=0$ and $[q_i, p_j] = i \delta_{ij}$ where the indices label the particles. Therefore, the integral will become separable. Namely, we have that 
\begin{align*}
&\tilde{\mathrm{tr}}\left\{f(\mathbf {\hat q}, \mathbf {\hat p})\right\}\equiv\int_{\mathbb{R}^N} \mathrm d\mathbf {\hat q} \left\langle\mathbf q\middle|f\left(\mathbf {\hat q} ,-i\frac{\partial}{\partial {\mathbf {\hat q} }}\right) \middle|\mathbf q\right\rangle\\
&=\int dq_1\cdots\int d q_N \langle q_1|\langle q_2| \cdots\langle q_N| \left(\hat q_1^{n_1}\cdots \hat q_N^{n_N}\left(-i\frac{\partial}{\partial \hat q_1}\right)^{m_1}\cdots \left(-i\frac{\partial}{\partial \hat q_N}\right)^{m_N} | q_1 \rangle |q_2\rangle \cdots |q_N\rangle \right)
\end{align*}
where I have made use of the definition of the direct product on a hilbert space for $N$ particles. 
Given our commutation relations, these integrals are separable. That is, 
\begin{align*}
&\tilde{\mathrm{tr}}\left\{f(\mathbf {\hat q}, \mathbf {\hat p})\right\}=\prod_{i=1}^N \int dq_i \langle q_i| \hat{q}_i^{n_i}\hat{p}_i^{m_i}|q_i\rangle
\end{align*}
Now this we can deal with. first recall that $\langle q_i| \hat{q}_i = \langle q_i| q_i$ so that 
\begin{align*}
&\tilde{\mathrm{tr}}\left\{f(\mathbf {\hat q}, \mathbf {\hat p})\right\}=\prod_{i=1}^N \int dq_i \int dp_i \langle q_i| q_i^{n_i}\hat{p}_i^{m_i}|q_i\rangle
\end{align*}
To take care of the momentum we insert unity resolved in the momentum basis of particle $i$ so that 
\begin{align*}
&\tilde{\mathrm{tr}}\left\{f(\mathbf {\hat q}, \mathbf {\hat p})\right\}=\prod_{i=1}^N \int dq_i \int dp_i \langle q_i| q_i^{n_i}\hat{p}_i^{m_i}|p_i \rangle \underbrace{\langle p_i|q_i\rangle}_{\frac{e^{-iq_ip_i}}{\sqrt{2\pi}}}\\
&=\frac{1}{(2\pi)^{\frac{N}{2}}}\prod_{i=1}^N \int dq_i \int dp_i q_i^{n_i} p_i^{m_i} \langle q_i|p_i \rangle e^{-ip_i q_i}\\
&=\frac{1}{(2\pi)^{\frac{N}{2}}}\prod_{i=1}^N \int dq_i \int dp_i q_i^{n_i} p_i^{m_i} e^{ip_i q_i} e^{-ip_i q_i}\\
&=\frac{1}{(2\pi)^{\frac{N}{2}}}\prod_{i=1}^N \left(\int_{\mathbb{R}} dq_i q_i^{n_i}\right)\left(  \int_{\mathbb{R}} dp_i p_i^{m_i} \right)
\end{align*}
so indeed it appears that unless we impose a momentum cutoff and restrict ourself to a finite region of space then what we have is just a big product of divergences, and hence is not a well defined map from $\mathcal{H}\to \mathbb{R}$.
As for your question regarding the weighting factor of the hamiltonian I believe that the answer ought to depend on what the actual hamiltonian is, but if you think that's incorrect I can reconsider and try to approach that for general $\hat{H}$.
