Algebraic demand curve in a perfectly competitive market for a firm
If we're considering the canonical case of one firm facing perfect competition, then we're faced with a demand curve (for each firm's goods) that's perfectly flat- regardless of how many units any given firm produces, consumers are willing to pay a certain market price $p$ and no more (all of this is just a restatement of what you've mentioned in the question, of course). 

What we can do is then consider how to have a model that incorporates this definition of perfect competition with your given definition of the demand facing firm $i$. As you point out, the derivative of the demand as you've defined it is $\beta$. (Again, all a restatement of what you've pointed out).

The next question to ask, then, is "what is $\beta$?" Effectively, it's the slope of the demand curve each firm faces. If we assume perfect competition, then we assume a flat demand curve, which leads us to conclude that $\beta=0$. I'd suggest that your reasoning didn't go wrong anywhere, just that the two threads need to be directly connected!