We have a family of $N$ triples $(x_i,y_i,z_i)$, ($1\le i \le N$) and $N$ bins. We want to distribute the elements of each triple into bins such that each bin has three elements and no bin gets the three elements of any triple ($(x_i,y_i,z_i)$).
Note that triples do not share any elements. The total number of all elements is $3N$.
In how many ways can we perform this?
You can do this using inclusion–exclusion.
There are $\frac{(3N)!}{3!^N}$ ways to distribute the elements over the bins. If $k$ particular bins contain all the elements of a triple, there are $\frac{(3(N-k))!}{3!^{N-k}}$ ways to distribute the remaining elements over the remaining triples. There are $\binom Nk$ ways to choose the $k$ particular bins and $\frac{N!}{(N-k)!}$ ways to choose triples for them. Thus the number of distributions in which no bin contains all elements of a triple is
$$ \sum_{k=0}^N(-1)^k\binom Nk\frac{N!}{(N-k)!}\frac{(3(N-k))!}{3!^{N-k}}\;. $$