The coherent state path integral for the partition function of a theory of bosons is an integral over fields ϕ(τ,x),¯ϕ(τ,x); these are the classical fields corresponding to the bosonic creation annihilation operators b(x),b†(x):
tr(e−βˆH)=∫d[ϕ,¯ϕ]e−S[ϕ,¯ϕ]
Now perform a change of variable in the path integral ϕ(x),¯ϕ(x)→n(x),θ(x) where ϕ=√neiθ. This is the "number phase" representation (see Altland and Simons, chapter 6). The change of variables is a canonical mapping i.e., it preserves the classical poisson bracket. [It has some pathologies at n=0 which we'll ignore]
So n,θ are canonically conjugate variables. Now remember that in a theory of bosons, ˆb†(x)ˆb(x), or ¯ϕ(x)ϕ(x) in the path integral, is the local particle density. But note too that ¯ϕ(x)ϕ(x)=n(x); hence we can identify n(x) with the local particle density. What you're calling N is the zeroth spatial fourier component of n(x), and what you're calling θ0 is the zeroth fourier component of θ(x). That N,θ0 are canonically conjugate follows from fact n(x),θ(x) are canonically conjugate.